close settings with esc

This commit is contained in:
Ioannis G 2015-09-26 00:50:22 +03:00
parent a1988f91c1
commit 860210628e
3 changed files with 15 additions and 1 deletions

View File

@ -108,5 +108,10 @@ namespace Wox
return false;
}
public new bool IsFocused
{
get { return tbHotkey.IsFocused; }
}
}
}

View File

@ -11,7 +11,7 @@
Title="{DynamicResource woxsettings}"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
Height="600" Width="800">
Height="600" Width="800" PreviewKeyDown="Window_PreviewKeyDown">
<Window.Resources>
<ListBoxItem HorizontalContentAlignment="Stretch"
IsEnabled="False"

View File

@ -774,5 +774,14 @@ namespace Wox
}
#endregion
private void Window_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
// Hide window with ESC, but make sure it is not pressed as a hotkey
if (e.Key == Key.Escape && !ctlHotkey.IsFocused)
{
Close();
}
}
}
}