private static void AddShortcut(ref List <KeyboardShortcut> list, KeyboardCombination combination, Key key, string method, RoutedMethodRegistry mr) { try { var res = mr[method]; KeyboardShortcut ks = new KeyboardShortcut(combination, key, res.handler, res.methodId, res.menuItem); list.Add(ks); } catch (KeyNotFoundException) { } }
//public KeyboardShortcut() { } /// <summary> /// Create a keyboard shortcut entry. /// </summary> /// <param name="combination">The key combination needed, if any, for activating this shortcut.</param> /// <param name="key">The specific key that corresponds to this shortcut.</param> /// <param name="action">The action to perform when this shortcut is activated.</param> public KeyboardShortcut(KeyboardCombination combination, Key key, IKeyAction action) { Combination = combination; Key = key; Action = action; MethodId = action.ID; GenerateKeyString(); SourceElement = action.SourceElement; }
/// <summary> /// Create a keyboard shortcut entry. /// </summary> /// <param name="combination">The key combination needed, if any, for activating this shortcut.</param> /// <param name="key">The specific key that corresponds to this shortcut.</param> /// <param name="method">The method to run when this shortcut is used.</param> /// <param name="methodId">The ID string/name for this method.</param> /// <param name="menuItem">The menu item corresponding with the method.</param> public KeyboardShortcut(KeyboardCombination combination, Key key, RoutedEventHandler?method, string methodId, System.Windows.Controls.MenuItem?menuItem) { Combination = combination; Key = key; Method = method; MethodId = methodId; if (menuItem != null) { GenerateKeyString(); MethodHolder = menuItem; } else { KeyString = ""; MethodHolder = null; } }
public void RegisterKeyShortcut(KeyboardCombination combination, Key key, (string methodId, RoutedEventHandler method, MenuItem? menuItem) methodRegistryItem)
public void RegisterKeyShortcut(KeyboardCombination combination, Key key, RoutedEventHandler method, string methodId, MenuItem?menuItem) { KeyboardShortcut kc = new KeyboardShortcut(combination, key, method, methodId, menuItem); RegisterKeyShortcut(kc); }
public KeyEntry(KeyboardCombination combination, Key key, string methodId) { KeyboardCombination = combination; Key = key; MethodId = methodId; }