private static void KeyboardHookOnKeyPressed(object sender, KeyPressedEventArgs e) { Action action; var hotKey = HotKey.FromKeyPressedEventArgs(e); if(RegisteredHotKeys.TryGetValue(hotKey, out action)) { Log.Info($"[{hotKey}] pressed."); action.Invoke(); } }
public static HotKey FromKeyPressedEventArgs(KeyPressedEventArgs args) => new HotKey(args.Modifier, args.Key);
private static void KeyboardHookOnKeyPressed(object sender, KeyPressedEventArgs e) { Action action; if(_registeredHotKeys.TryGetValue(HotKey.FromKeyPressedEventArgs(e), out action)) action.Invoke(); }