From b3e5f09c838901c780126c23b15da635f09329e9 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Sat, 22 Feb 2014 15:52:20 +0800 Subject: [PATCH] Add custom plugin hotkey feature. --- Wox.Infrastructure/CommonStorage.cs | 2 +- Wox.Infrastructure/HotkeyModel.cs | 126 ++++++++++++++++++ .../UserSettings/PluginHotkey.cs | 13 ++ .../UserSettings/UserSetting.cs | 2 +- Wox.Infrastructure/Wox.Infrastructure.csproj | 1 + Wox/CustomPluginHotkeySetting.xaml | 35 +++++ Wox/CustomPluginHotkeySetting.xaml.cs | 111 +++++++++++++++ Wox/HotkeyControl.xaml | 2 +- Wox/HotkeyControl.xaml.cs | 50 +++---- Wox/MainWindow.xaml.cs | 50 ++++--- Wox/SettingWindow.xaml | 50 ++++++- Wox/SettingWindow.xaml.cs | 100 +++++++++++--- Wox/Wox.csproj | 7 + 13 files changed, 483 insertions(+), 66 deletions(-) create mode 100644 Wox.Infrastructure/HotkeyModel.cs create mode 100644 Wox.Infrastructure/UserSettings/PluginHotkey.cs create mode 100644 Wox/CustomPluginHotkeySetting.xaml create mode 100644 Wox/CustomPluginHotkeySetting.xaml.cs diff --git a/Wox.Infrastructure/CommonStorage.cs b/Wox.Infrastructure/CommonStorage.cs index 19e6776736..c26c5eacf4 100644 --- a/Wox.Infrastructure/CommonStorage.cs +++ b/Wox.Infrastructure/CommonStorage.cs @@ -62,7 +62,7 @@ namespace Wox.Infrastructure Instance.UserSetting.Theme = "Default"; Instance.UserSetting.ReplaceWinR = true; Instance.UserSetting.WebSearches = Instance.UserSetting.LoadDefaultWebSearches(); - Instance.UserSetting.Hotkey = "Win + W"; + Instance.UserSetting.Hotkey = "Alt + Space"; } public static CommonStorage Instance diff --git a/Wox.Infrastructure/HotkeyModel.cs b/Wox.Infrastructure/HotkeyModel.cs new file mode 100644 index 0000000000..f53447731b --- /dev/null +++ b/Wox.Infrastructure/HotkeyModel.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Input; +using System.Windows.Media.Animation; + +namespace Wox.Infrastructure +{ + public class HotkeyModel + { + public bool Alt { get; set; } + public bool Shift { get; set; } + public bool Win { get; set; } + public bool Ctrl { get; set; } + public Key CharKey { get; set; } + + public ModifierKeys ModifierKeys + { + get + { + ModifierKeys modifierKeys = ModifierKeys.None; + if (Alt) + { + modifierKeys = ModifierKeys.Alt; + } + if (Shift) + { + modifierKeys = modifierKeys | ModifierKeys.Shift; + } + if (Win) + { + modifierKeys = modifierKeys | ModifierKeys.Windows; + } + if (Ctrl) + { + modifierKeys = modifierKeys | ModifierKeys.Control; + } + return modifierKeys; + } + } + + public HotkeyModel() { } + + public HotkeyModel(string hotkeyString) + { + ParseHotkey(hotkeyString); + } + + public HotkeyModel(bool alt, bool shift, bool win, bool ctrl, Key key) + { + Alt = alt; + Shift = shift; + Win = win; + Ctrl = ctrl; + CharKey = key; + } + + private void ParseHotkey(string hotkeyString) + { + if (!string.IsNullOrEmpty(hotkeyString)) + { + List keys = hotkeyString.Replace(" ", "").Split('+').ToList(); + if (keys.Contains("Alt")) + { + Alt = true; + keys.Remove("Alt"); + } + if (keys.Contains("Shift")) + { + Shift = true; + keys.Remove("Shift"); + } + if (keys.Contains("Win")) + { + Win = true; + keys.Remove("Win"); + } + if (keys.Contains("Ctrl")) + { + Ctrl = true; + keys.Remove("Ctrl"); + } + if (keys.Count > 0) + { + string charKey = keys[0]; + try + { + CharKey = (Key)Enum.Parse(typeof(Key), charKey); + } + catch + { + + } + } + } + } + + public override string ToString() + { + string text = string.Empty; + if (Ctrl) + { + text += "Ctrl"; + } + if (Alt) + { + text += string.IsNullOrEmpty(text) ? "Alt" : " + Alt"; + } + if (Shift) + { + text += string.IsNullOrEmpty(text) ? "Shift" : " + Shift"; + } + if (Win) + { + text += string.IsNullOrEmpty(text) ? "Win" : " + Win"; + } + if (!string.IsNullOrEmpty(CharKey.ToString())) + { + text += string.IsNullOrEmpty(text) ? CharKey.ToString() : " + " + CharKey; + } + + return text; + } + } +} diff --git a/Wox.Infrastructure/UserSettings/PluginHotkey.cs b/Wox.Infrastructure/UserSettings/PluginHotkey.cs new file mode 100644 index 0000000000..d8dbb48e96 --- /dev/null +++ b/Wox.Infrastructure/UserSettings/PluginHotkey.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Wox.Infrastructure.UserSettings +{ + public class CustomPluginHotkey + { + public string Hotkey { get; set; } + public string ActionKeyword { get; set; } + } +} diff --git a/Wox.Infrastructure/UserSettings/UserSetting.cs b/Wox.Infrastructure/UserSettings/UserSetting.cs index c766378ec2..c2309bae82 100644 --- a/Wox.Infrastructure/UserSettings/UserSetting.cs +++ b/Wox.Infrastructure/UserSettings/UserSetting.cs @@ -9,7 +9,7 @@ namespace Wox.Infrastructure.UserSettings public string Theme { get; set; } public bool ReplaceWinR { get; set; } public List WebSearches { get; set; } - + public List CustomPluginHotkeys { get; set; } public bool StartWoxOnSystemStartup { get; set; } public List LoadDefaultWebSearches() diff --git a/Wox.Infrastructure/Wox.Infrastructure.csproj b/Wox.Infrastructure/Wox.Infrastructure.csproj index 504e8dc655..723ebd6f0a 100644 --- a/Wox.Infrastructure/Wox.Infrastructure.csproj +++ b/Wox.Infrastructure/Wox.Infrastructure.csproj @@ -55,6 +55,7 @@ + diff --git a/Wox/CustomPluginHotkeySetting.xaml b/Wox/CustomPluginHotkeySetting.xaml new file mode 100644 index 0000000000..ac3bc9f632 --- /dev/null +++ b/Wox/CustomPluginHotkeySetting.xaml @@ -0,0 +1,35 @@ + + + + + + + + + + + + Hotkey: + + + Action Keyword: + + + + + + + + + + + diff --git a/Wox/CustomPluginHotkeySetting.xaml.cs b/Wox/CustomPluginHotkeySetting.xaml.cs new file mode 100644 index 0000000000..64acbbc8cf --- /dev/null +++ b/Wox/CustomPluginHotkeySetting.xaml.cs @@ -0,0 +1,111 @@ +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.Shapes; +using Wox.Infrastructure; +using Wox.Infrastructure.UserSettings; + +namespace Wox +{ + public partial class CustomPluginHotkeySetting : Window + { + private SettingWidow settingWidow; + private bool update; + private CustomPluginHotkey updateCustomHotkey; + + + public CustomPluginHotkeySetting(SettingWidow settingWidow) + { + this.settingWidow = settingWidow; + InitializeComponent(); + } + + private void BtnCancel_OnClick(object sender, RoutedEventArgs e) + { + Close(); + } + + private void btnAdd_OnClick(object sender, RoutedEventArgs e) + { + if (!update) + { + if (!ctlHotkey.CurrentHotkeyAvailable) + { + MessageBox.Show("Hotkey is unavailable, please select a new hotkey"); + return; + } + + if (CommonStorage.Instance.UserSetting.CustomPluginHotkeys == null) + { + CommonStorage.Instance.UserSetting.CustomPluginHotkeys = new List(); + } + + var pluginHotkey = new CustomPluginHotkey() + { + Hotkey = ctlHotkey.CurrentHotkey.ToString(), + ActionKeyword = tbAction.Text + }; + CommonStorage.Instance.UserSetting.CustomPluginHotkeys.Add(pluginHotkey); + settingWidow.MainWindow.SetHotkey(ctlHotkey.CurrentHotkey.ToString(), delegate + { + settingWidow.MainWindow.ShowApp(); + settingWidow.MainWindow.ChangeQuery(pluginHotkey.ActionKeyword); + }); + MessageBox.Show("Add hotkey successfully!"); + } + else + { + if (updateCustomHotkey.Hotkey != ctlHotkey.CurrentHotkey.ToString() && !ctlHotkey.CurrentHotkeyAvailable) + { + MessageBox.Show("Hotkey is unavailable, please select a new hotkey"); + return; + } + var oldHotkey = updateCustomHotkey.Hotkey; + updateCustomHotkey.ActionKeyword = tbAction.Text; + updateCustomHotkey.Hotkey = ctlHotkey.CurrentHotkey.ToString(); + //remove origin hotkey + settingWidow.MainWindow.RemoveHotkey(oldHotkey); + settingWidow.MainWindow.SetHotkey(updateCustomHotkey.Hotkey, delegate + { + settingWidow.MainWindow.ShowApp(); + settingWidow.MainWindow.ChangeQuery(updateCustomHotkey.ActionKeyword); + }); + MessageBox.Show("Update successfully!"); + } + + CommonStorage.Instance.Save(); + settingWidow.ReloadCustomPluginHotkeyView(); + Close(); + } + + public void UpdateItem(CustomPluginHotkey item) + { + updateCustomHotkey = CommonStorage.Instance.UserSetting.CustomPluginHotkeys.FirstOrDefault(o => o.ActionKeyword == item.ActionKeyword && o.Hotkey == item.Hotkey); + if (updateCustomHotkey == null) + { + MessageBox.Show("Invalid plugin hotkey"); + Close(); + return; + } + + tbAction.Text = updateCustomHotkey.ActionKeyword; + ctlHotkey.SetHotkey(updateCustomHotkey.Hotkey, false); + update = true; + lblAdd.Text = "Update"; + } + + private void BtnTestActionKeyword_OnClick(object sender, RoutedEventArgs e) + { + settingWidow.MainWindow.ShowApp(); + settingWidow.MainWindow.ChangeQuery(tbAction.Text); + } + } +} diff --git a/Wox/HotkeyControl.xaml b/Wox/HotkeyControl.xaml index df03049126..6ea40d1cd3 100644 --- a/Wox/HotkeyControl.xaml +++ b/Wox/HotkeyControl.xaml @@ -11,7 +11,7 @@ - + diff --git a/Wox/HotkeyControl.xaml.cs b/Wox/HotkeyControl.xaml.cs index 5e66ec17a2..1d64f0fc7f 100644 --- a/Wox/HotkeyControl.xaml.cs +++ b/Wox/HotkeyControl.xaml.cs @@ -1,5 +1,6 @@ using System; using System.Drawing; +using System.Runtime.InteropServices; using System.Windows; using System.Windows.Input; using System.Windows.Media; @@ -31,16 +32,9 @@ namespace Wox InitializeComponent(); } - public void SetHotkey(HotkeyModel model) - { - if (model != null) - { - SetHotkey(model.ToString()); - } - } - private void TbHotkey_OnPreviewKeyDown(object sender, KeyEventArgs e) { + e.Handled = true; tbMsg.Visibility = Visibility.Hidden; //when alt is pressed, the real key should be e.SystemKey @@ -77,31 +71,41 @@ namespace Wox { text += " + Space"; } - - e.Handled = true; + else + { + return; + } + + if (text == tbHotkey.Text) + { + return; + } Dispatcher.DelayInvoke("HotkeyAvailableTest", o => SetHotkey(text), TimeSpan.FromMilliseconds(300)); } - public void SetHotkey(string keyStr) + public void SetHotkey(string keyStr, bool triggerValidate = true) { + tbMsg.Visibility = Visibility.Visible; tbHotkey.Text = keyStr; tbHotkey.Select(tbHotkey.Text.Length, 0); - CurrentHotkey = new HotkeyModel(keyStr); - CurrentHotkeyAvailable = CheckHotAvailabel(CurrentHotkey); - tbMsg.Visibility = Visibility.Visible; - if (!CurrentHotkeyAvailable) + + if (triggerValidate) { - tbMsg.Foreground = new SolidColorBrush(Colors.Red); - tbMsg.Text = "hotkey unavailable"; + CurrentHotkeyAvailable = CheckHotAvailabel(CurrentHotkey); + if (!CurrentHotkeyAvailable) + { + tbMsg.Foreground = new SolidColorBrush(Colors.Red); + tbMsg.Text = "hotkey unavailable"; + } + else + { + tbMsg.Foreground = new SolidColorBrush(Colors.Green); + tbMsg.Text = "succeed"; + } + OnOnHotkeyChanged(); } - else - { - tbMsg.Foreground = new SolidColorBrush(Colors.Green); - tbMsg.Text = "hotkey available"; - } - OnOnHotkeyChanged(); } private bool CheckHotAvailabel(HotkeyModel hotkey) diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 2d4b54daa0..7be4a4f61d 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -15,6 +15,7 @@ using NHotkey; using NHotkey.Wpf; using Wox.Commands; using Wox.Infrastructure; +using Wox.Infrastructure.UserSettings; using Wox.Plugin; using Wox.PluginLoader; using Application = System.Windows.Application; @@ -58,18 +59,35 @@ namespace Wox Closing += MainWindow_Closing; } - public void SetHotkey(string hotkeyStr) + public void SetHotkey(string hotkeyStr,EventHandler action) { HotkeyModel hotkey = new HotkeyModel(hotkeyStr); try { - HotkeyManager.Current.AddOrReplace("ShowHideWox", hotkey.CharKey, hotkey.ModifierKeys, OnHotkey); + HotkeyManager.Current.AddOrReplace(hotkeyStr, hotkey.CharKey, hotkey.ModifierKeys,action); } catch (Exception) { MessageBox.Show("Registe hotkey: " + CommonStorage.Instance.UserSetting.Hotkey + " failed."); } + } + public void RemoveHotkey(string hotkeyStr) + { + HotkeyManager.Current.Remove(hotkeyStr); + } + + private void SetCustomPluginHotkey() + { + foreach (CustomPluginHotkey hotkey in CommonStorage.Instance.UserSetting.CustomPluginHotkeys) + { + CustomPluginHotkey hotkey1 = hotkey; + SetHotkey(hotkey.Hotkey,delegate + { + ShowApp(); + ChangeQuery(hotkey1.ActionKeyword); + }); + } } private void OnHotkey(object sender, HotkeyEventArgs e) @@ -96,7 +114,7 @@ namespace Wox //This is caused by the Virtual Mermory Page Mechanisam. So, our solution is execute some codes in every min //which may prevent sysetem uninstall memory from RAM to disk. - var t = new Timer(1000*60*5) {AutoReset = true, Enabled = true}; + var t = new Timer(1000 * 60 * 5) { AutoReset = true, Enabled = true }; t.Elapsed += (o, e) => Dispatcher.Invoke(new Action(() => { if (Visibility != Visibility.Visible) @@ -126,21 +144,21 @@ namespace Wox private void InitialTray() { - notifyIcon = new NotifyIcon {Text = "Wox", Icon = Properties.Resources.app, Visible = true}; + notifyIcon = new NotifyIcon { Text = "Wox", Icon = Properties.Resources.app, Visible = true }; notifyIcon.Click += (o, e) => ShowWox(); var open = new MenuItem("Open"); open.Click += (o, e) => ShowWox(); var exit = new MenuItem("Exit"); exit.Click += (o, e) => CloseApp(); - MenuItem[] childen = {open, exit}; + MenuItem[] childen = { open, exit }; notifyIcon.ContextMenu = new ContextMenu(childen); } private void resultCtrl_resultItemChangedEvent() { resultCtrl.Margin = resultCtrl.GetCurrentResultCount() > 0 - ? new Thickness {Top = grid.Margin.Top} - : new Thickness {Top = 0}; + ? new Thickness { Top = grid.Margin.Top } + : new Thickness { Top = 0 }; } private void TextBoxBase_OnTextChanged(object sender, TextChangedEventArgs e) @@ -225,10 +243,11 @@ namespace Wox private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) { - Left = (SystemParameters.PrimaryScreenWidth - ActualWidth)/2; - Top = (SystemParameters.PrimaryScreenHeight - ActualHeight)/3; + Left = (SystemParameters.PrimaryScreenWidth - ActualWidth) / 2; + Top = (SystemParameters.PrimaryScreenHeight - ActualHeight) / 3; - SetHotkey(CommonStorage.Instance.UserSetting.Hotkey); + SetHotkey(CommonStorage.Instance.UserSetting.Hotkey,OnHotkey); + SetCustomPluginHotkey(); WakeupApp(); Plugins.Init(); @@ -240,13 +259,13 @@ namespace Wox if (CommonStorage.Instance.UserSetting.ReplaceWinR) { //todo:need refatoring. move those codes to CMD file or expose events - if (keyevent == KeyEvent.WM_KEYDOWN && vkcode == (int) Keys.R && state.WinPressed) + if (keyevent == KeyEvent.WM_KEYDOWN && vkcode == (int)Keys.R && state.WinPressed) { WinRStroked = true; Dispatcher.BeginInvoke(new Action(OnWinRPressed)); return false; } - if (keyevent == KeyEvent.WM_KEYUP && WinRStroked && vkcode == (int) Keys.LWin) + if (keyevent == KeyEvent.WM_KEYUP && WinRStroked && vkcode == (int)Keys.LWin) { WinRStroked = false; keyboardSimulator.ModifiedKeyStroke(VirtualKeyCode.LWIN, VirtualKeyCode.CONTROL); @@ -345,8 +364,6 @@ namespace Wox #region Public API - //Those method can be invoked by plugins - public void ChangeQuery(string query) { tbQuery.Text = query; @@ -371,14 +388,13 @@ namespace Wox public void ShowMsg(string title, string subTitle, string iconPath) { - var m = new Msg {Owner = GetWindow(this)}; + var m = new Msg { Owner = GetWindow(this) }; m.Show(title, subTitle, iconPath); } public void OpenSettingDialog() { - var s = new SettingWidow(this); - s.Show(); + new SettingWidow(this).Show(); } #endregion diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index ba04be28f2..5c3c5f390b 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -23,13 +23,55 @@ - - - + + + + + + + + + + Wox Hotkey: + + + + Custom Plugin Hotkey: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index 04fbdcf262..e2999dbd47 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -19,7 +19,7 @@ namespace Wox { public partial class SettingWidow : Window { - private MainWindow mainWindow; + public MainWindow MainWindow; public SettingWidow() { @@ -28,11 +28,17 @@ namespace Wox public SettingWidow(MainWindow mainWindow) { - this.mainWindow = mainWindow; + this.MainWindow = mainWindow; InitializeComponent(); Loaded += Setting_Loaded; + } + + + + private void Setting_Loaded(object sender, RoutedEventArgs ev) + { ctlHotkey.OnHotkeyChanged += ctlHotkey_OnHotkeyChanged; - ctlHotkey.SetHotkey(CommonStorage.Instance.UserSetting.Hotkey); + ctlHotkey.SetHotkey(CommonStorage.Instance.UserSetting.Hotkey, false); cbReplaceWinR.Checked += (o, e) => { CommonStorage.Instance.UserSetting.ReplaceWinR = true; @@ -43,20 +49,7 @@ namespace Wox CommonStorage.Instance.UserSetting.ReplaceWinR = false; CommonStorage.Instance.Save(); }; - } - void ctlHotkey_OnHotkeyChanged(object sender, System.EventArgs e) - { - if (ctlHotkey.CurrentHotkeyAvailable) - { - mainWindow.SetHotkey(ctlHotkey.CurrentHotkey.ToString()); - CommonStorage.Instance.UserSetting.Hotkey = ctlHotkey.CurrentHotkey.ToString(); - CommonStorage.Instance.Save(); - } - } - - private void Setting_Loaded(object sender, RoutedEventArgs e) - { foreach (string theme in LoadAvailableThemes()) { string themeName = theme.Substring(theme.LastIndexOf('\\') + 1).Replace(".xaml", ""); @@ -66,6 +59,7 @@ namespace Wox themeComboBox.SelectedItem = CommonStorage.Instance.UserSetting.Theme; cbReplaceWinR.IsChecked = CommonStorage.Instance.UserSetting.ReplaceWinR; webSearchView.ItemsSource = CommonStorage.Instance.UserSetting.WebSearches; + lvCustomHotkey.ItemsSource = CommonStorage.Instance.UserSetting.CustomPluginHotkeys; cbStartWithWindows.IsChecked = CommonStorage.Instance.UserSetting.StartWoxOnSystemStartup; } @@ -83,7 +77,7 @@ namespace Wox private void ThemeComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { string themeName = themeComboBox.SelectedItem.ToString(); - mainWindow.SetTheme(themeName); + MainWindow.SetTheme(themeName); CommonStorage.Instance.UserSetting.Theme = themeName; CommonStorage.Instance.Save(); } @@ -91,7 +85,7 @@ namespace Wox private void btnAddWebSearch_OnClick(object sender, RoutedEventArgs e) { WebSearchSetting webSearch = new WebSearchSetting(this); - webSearch.Show(); + webSearch.ShowDialog(); } private void btnDeleteWebSearch_OnClick(object sender, RoutedEventArgs e) @@ -116,8 +110,8 @@ namespace Wox if (seletedWebSearch != null) { WebSearchSetting webSearch = new WebSearchSetting(this); - webSearch.Show(); webSearch.UpdateItem(seletedWebSearch); + webSearch.ShowDialog(); } else { @@ -171,6 +165,74 @@ namespace Wox } } + void ctlHotkey_OnHotkeyChanged(object sender, System.EventArgs e) + { + if (ctlHotkey.CurrentHotkeyAvailable) + { + MainWindow.SetHotkey(ctlHotkey.CurrentHotkey.ToString(), delegate + { + if (!MainWindow.IsVisible) + { + MainWindow.ShowApp(); + } + else + { + MainWindow.HideApp(); + } + }); + MainWindow.RemoveHotkey(CommonStorage.Instance.UserSetting.Hotkey); + CommonStorage.Instance.UserSetting.Hotkey = ctlHotkey.CurrentHotkey.ToString(); + CommonStorage.Instance.Save(); + } + } + + #region Custom Plugin Hotkey + + private void BtnDeleteCustomHotkey_OnClick(object sender, RoutedEventArgs e) + { + CustomPluginHotkey item = lvCustomHotkey.SelectedItem as CustomPluginHotkey; + if (item != null && + MessageBox.Show("Are your sure to delete " + item.Hotkey + " plugin hotkey?","Delete Custom Plugin Hotkey", + MessageBoxButton.YesNo) == MessageBoxResult.Yes) + { + CommonStorage.Instance.UserSetting.CustomPluginHotkeys.Remove(item); + lvCustomHotkey.Items.Refresh(); + CommonStorage.Instance.Save(); + MainWindow.RemoveHotkey(item.Hotkey); + } + else + { + MessageBox.Show("Please select an item"); + } + } + + private void BtnEditCustomHotkey_OnClick(object sender, RoutedEventArgs e) + { + CustomPluginHotkey item = lvCustomHotkey.SelectedItem as CustomPluginHotkey; + if (item != null) + { + CustomPluginHotkeySetting window = new CustomPluginHotkeySetting(this); + window.UpdateItem(item); + window.ShowDialog(); + } + else + { + MessageBox.Show("Please select an item"); + } + } + + private void BtnAddCustomeHotkey_OnClick(object sender, RoutedEventArgs e) + { + new CustomPluginHotkeySetting(this).ShowDialog(); + } + + public void ReloadCustomPluginHotkeyView() + { + lvCustomHotkey.Items.Refresh(); + } + + #endregion + } } diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 50b0e60845..58aa7200ba 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -125,6 +125,9 @@ + + CustomPluginHotkeySetting.xaml + @@ -153,6 +156,10 @@ WebSearchSetting.xaml + + Designer + MSBuild:Compile + Designer MSBuild:Compile