From f01de3a69d89a90194dbf9495960cec6caa7ea7a Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Fri, 4 Jul 2014 15:34:31 +0800 Subject: [PATCH] Move CMD settings to CMD plugin details. --- Wox.Plugin.SystemPlugins/CMD/CMD.cs | 8 ++- Wox.Plugin.SystemPlugins/CMD/CMDSetting.xaml | 25 +++++++++ .../CMD/CMDSetting.xaml.cs | 54 +++++++++++++++++++ .../Wox.Plugin.SystemPlugins.csproj | 7 +++ Wox/SettingWindow.xaml | 8 --- Wox/SettingWindow.xaml.cs | 23 -------- 6 files changed, 93 insertions(+), 32 deletions(-) create mode 100644 Wox.Plugin.SystemPlugins/CMD/CMDSetting.xaml create mode 100644 Wox.Plugin.SystemPlugins/CMD/CMDSetting.xaml.cs diff --git a/Wox.Plugin.SystemPlugins/CMD/CMD.cs b/Wox.Plugin.SystemPlugins/CMD/CMD.cs index aeeb8405ae..c205e3dca4 100644 --- a/Wox.Plugin.SystemPlugins/CMD/CMD.cs +++ b/Wox.Plugin.SystemPlugins/CMD/CMD.cs @@ -4,10 +4,11 @@ using System.IO; using System.Linq; using System.Runtime.Serialization.Formatters.Binary; using System.Windows.Forms; +using Control = System.Windows.Controls.Control; namespace Wox.Plugin.SystemPlugins.CMD { - public class CMD : BaseSystemPlugin + public class CMD : BaseSystemPlugin,ISettingProvider { private PluginInitContext context; @@ -167,5 +168,10 @@ namespace Wox.Plugin.SystemPlugins.CMD { get { return "Provide executing commands from Wox. Commands should start with >"; } } + + public Control CreateSettingPanel() + { + return new CMDSetting(); + } } } diff --git a/Wox.Plugin.SystemPlugins/CMD/CMDSetting.xaml b/Wox.Plugin.SystemPlugins/CMD/CMDSetting.xaml new file mode 100644 index 0000000000..593e6a02a8 --- /dev/null +++ b/Wox.Plugin.SystemPlugins/CMD/CMDSetting.xaml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + diff --git a/Wox.Plugin.SystemPlugins/CMD/CMDSetting.xaml.cs b/Wox.Plugin.SystemPlugins/CMD/CMDSetting.xaml.cs new file mode 100644 index 0000000000..d0bc06f568 --- /dev/null +++ b/Wox.Plugin.SystemPlugins/CMD/CMDSetting.xaml.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Wox.Infrastructure.Storage.UserSettings; + +namespace Wox.Plugin.SystemPlugins.CMD +{ + public partial class CMDSetting : UserControl + { + public CMDSetting() + { + InitializeComponent(); + } + + private void CMDSetting_OnLoaded(object sender, RoutedEventArgs re) + { + cbReplaceWinR.IsChecked = UserSettingStorage.Instance.ReplaceWinR; + cbLeaveCmdOpen.IsChecked = UserSettingStorage.Instance.LeaveCmdOpen; + + cbLeaveCmdOpen.Checked += (o, e) => + { + UserSettingStorage.Instance.LeaveCmdOpen = true; + UserSettingStorage.Instance.Save(); + }; + + cbLeaveCmdOpen.Unchecked += (o, e) => + { + UserSettingStorage.Instance.LeaveCmdOpen = false; + UserSettingStorage.Instance.Save(); + }; + + cbReplaceWinR.Checked += (o, e) => + { + UserSettingStorage.Instance.ReplaceWinR = true; + UserSettingStorage.Instance.Save(); + }; + cbReplaceWinR.Unchecked += (o, e) => + { + UserSettingStorage.Instance.ReplaceWinR = false; + UserSettingStorage.Instance.Save(); + }; + } + } +} diff --git a/Wox.Plugin.SystemPlugins/Wox.Plugin.SystemPlugins.csproj b/Wox.Plugin.SystemPlugins/Wox.Plugin.SystemPlugins.csproj index 6766360457..809178144d 100644 --- a/Wox.Plugin.SystemPlugins/Wox.Plugin.SystemPlugins.csproj +++ b/Wox.Plugin.SystemPlugins/Wox.Plugin.SystemPlugins.csproj @@ -54,6 +54,9 @@ + + CMDSetting.xaml + @@ -102,6 +105,10 @@ + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index 889c84fcfc..37bae70fe9 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -26,14 +26,6 @@ - - - - - - - - diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index 0406350629..3a51899797 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -48,27 +48,6 @@ namespace Wox { ctlHotkey.OnHotkeyChanged += ctlHotkey_OnHotkeyChanged; ctlHotkey.SetHotkey(UserSettingStorage.Instance.Hotkey, false); - cbReplaceWinR.Checked += (o, e) => - { - UserSettingStorage.Instance.ReplaceWinR = true; - UserSettingStorage.Instance.Save(); - }; - cbReplaceWinR.Unchecked += (o, e) => - { - UserSettingStorage.Instance.ReplaceWinR = false; - UserSettingStorage.Instance.Save(); - }; - - cbLeaveCmdOpen.Checked += (o, e) => { - UserSettingStorage.Instance.LeaveCmdOpen = true; - UserSettingStorage.Instance.Save(); - }; - - cbLeaveCmdOpen.Unchecked += (o, e) => - { - UserSettingStorage.Instance.LeaveCmdOpen = false; - UserSettingStorage.Instance.Save(); - }; cbHideWhenDeactive.Checked += (o, e) => { @@ -82,10 +61,8 @@ namespace Wox UserSettingStorage.Instance.Save(); }; - cbReplaceWinR.IsChecked = UserSettingStorage.Instance.ReplaceWinR; lvCustomHotkey.ItemsSource = UserSettingStorage.Instance.CustomPluginHotkeys; cbStartWithWindows.IsChecked = File.Exists(woxLinkPath); - cbLeaveCmdOpen.IsChecked = UserSettingStorage.Instance.LeaveCmdOpen; cbHideWhenDeactive.IsChecked = UserSettingStorage.Instance.HideWhenDeactive; #region Load Theme