From a1988f91c1ae916f082343d33a1bc5bc3d792095 Mon Sep 17 00:00:00 2001 From: Ioannis G Date: Fri, 25 Sep 2015 23:43:09 +0300 Subject: [PATCH 1/2] fix tab populating in settings (fixes #291) --- Wox/SettingWindow.xaml | 8 +++---- Wox/SettingWindow.xaml.cs | 50 ++++++++++++++------------------------- 2 files changed, 22 insertions(+), 36 deletions(-) diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index 4b5a39336f..34582c8524 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -20,7 +20,7 @@ - + @@ -45,7 +45,7 @@ - + @@ -121,7 +121,7 @@ - + @@ -201,7 +201,7 @@ - + diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index 319c45bc48..5c8a5dd3b2 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -164,6 +164,24 @@ namespace Wox } } + private void settingTab_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + // Update controls inside the selected tab + + if (tabPlugin.IsSelected) + { + OnPluginTabSelected(); + } + else if (tabTheme.IsSelected) + { + OnThemeTabSelected(); + } + else if (tabHotkey.IsSelected) + { + OnHotkeyTabSelected(); + } + } + #region General private void LoadLanguages() @@ -243,17 +261,6 @@ namespace Wox } } - - private void TabHotkey_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) - { - var tabItem = sender as TabItem; - var clickingBody = (tabItem.Content as UIElement).IsMouseOver; - if (!clickingBody) - { - OnHotkeyTabSelected(); - } - } - private void OnHotkeyTabSelected() { ctlHotkey.HotkeyChanged += ctlHotkey_OnHotkeyChanged; @@ -422,16 +429,6 @@ namespace Wox } - private void TabTheme_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) - { - var tabItem = sender as TabItem; - var clickingBody = (tabItem.Content as UIElement).IsMouseOver; - if (!clickingBody) - { - OnThemeTabSelected(); - } - } - private void ThemeComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { string themeName = themeComboBox.SelectedItem.ToString(); @@ -666,17 +663,6 @@ namespace Wox lbPlugins.SelectedIndex = 0; } - private void TabPlugin_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) - { - var tabItem = sender as TabItem; - var clickingBody = (tabItem.Content as UIElement).IsMouseOver; - if (!clickingBody) - { - OnPluginTabSelected(); - } - } - - #endregion #region Proxy From 860210628ef38bff49df04e3c84fea15b31a3fc9 Mon Sep 17 00:00:00 2001 From: Ioannis G Date: Sat, 26 Sep 2015 00:50:22 +0300 Subject: [PATCH 2/2] close settings with esc --- Wox/HotkeyControl.xaml.cs | 5 +++++ Wox/SettingWindow.xaml | 2 +- Wox/SettingWindow.xaml.cs | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Wox/HotkeyControl.xaml.cs b/Wox/HotkeyControl.xaml.cs index 73b16f033b..135769c743 100644 --- a/Wox/HotkeyControl.xaml.cs +++ b/Wox/HotkeyControl.xaml.cs @@ -108,5 +108,10 @@ namespace Wox return false; } + + public new bool IsFocused + { + get { return tbHotkey.IsFocused; } + } } } diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index 34582c8524..ac40627a54 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -11,7 +11,7 @@ Title="{DynamicResource woxsettings}" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" - Height="600" Width="800"> + Height="600" Width="800" PreviewKeyDown="Window_PreviewKeyDown">