private void BtnDeleteCustomHotkey_OnClick(object sender, RoutedEventArgs e) { CustomPluginHotkey item = lvCustomHotkey.SelectedItem as CustomPluginHotkey; if (item == null) { MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem")); return; } string deleteWarning = string.Format(InternationalizationManager.Instance.GetTranslation("deleteCustomHotkeyWarning"), item.Hotkey); if (MessageBox.Show(deleteWarning, InternationalizationManager.Instance.GetTranslation("delete"), MessageBoxButton.YesNo) == MessageBoxResult.Yes) { _settings.CustomPluginHotkeys.Remove(item); lvCustomHotkey.Items.Refresh(); RemoveHotkey(item.Hotkey); } }
internal void SetCustomPluginHotkey() { if (_settings.CustomPluginHotkeys == null) { return; } foreach (CustomPluginHotkey hotkey in _settings.CustomPluginHotkeys) { CustomPluginHotkey hotkey1 = hotkey; SetHotkey(hotkey.Hotkey, delegate { if (ShouldIgnoreHotkeys()) { return; } ShowApp(); ChangeQuery(hotkey1.ActionKeyword, true); }); } }
private void SetCustomPluginHotkey() { if (UserSettingStorage.Instance.CustomPluginHotkeys == null) { return; } foreach (CustomPluginHotkey hotkey in UserSettingStorage.Instance.CustomPluginHotkeys) { CustomPluginHotkey hotkey1 = hotkey; SetHotkey(hotkey.Hotkey, delegate { if (ShouldIgnoreHotkeys()) { return; } ShowApp(); ChangeQuery(hotkey1.ActionKeyword, true); }); } }
private void btnAdd_OnClick(object sender, RoutedEventArgs e) { if (!update) { if (!ctlHotkey.CurrentHotkeyAvailable) { MessageBox.Show(InternationalizationManager.Instance.GetTranslation("hotkeyIsNotUnavailable")); return; } if (_settings.CustomPluginHotkeys == null) { _settings.CustomPluginHotkeys = new ObservableCollection <CustomPluginHotkey>(); } var pluginHotkey = new CustomPluginHotkey { Hotkey = ctlHotkey.CurrentHotkey.ToString(), ActionKeyword = tbAction.Text }; _settings.CustomPluginHotkeys.Add(pluginHotkey); HotKeyMapper.SetCustomQueryHotkey(pluginHotkey); } else { if (updateCustomHotkey.Hotkey != ctlHotkey.CurrentHotkey.ToString() && !ctlHotkey.CurrentHotkeyAvailable) { MessageBox.Show(InternationalizationManager.Instance.GetTranslation("hotkeyIsNotUnavailable")); return; } var oldHotkey = updateCustomHotkey.Hotkey; updateCustomHotkey.ActionKeyword = tbAction.Text; updateCustomHotkey.Hotkey = ctlHotkey.CurrentHotkey.ToString(); //remove origin hotkey HotKeyMapper.RemoveHotkey(oldHotkey); HotKeyMapper.SetCustomQueryHotkey(updateCustomHotkey); } Close(); }