public IDisposable Register(ShortcutKey shortcutKey, Action<IntPtr> action, Func<bool> canExecute) { var hook = new HookAction(shortcutKey, action, canExecute); this._hookActions.Add(hook); return Disposable.Create(() => this._hookActions.Remove(hook)); }
public IDisposable Register(ShortcutKey shortcutKey, Action <IntPtr> action, Func <bool> canExecute) { var hook = new HookAction(shortcutKey, action, canExecute); this._hookActions.Add(hook); return(Disposable.Create(() => this._hookActions.Remove(hook))); }
public static ShortcutKey ToShortcutKey(this int[] keyCodes) { if (keyCodes == null) return ShortcutKey.None; var key = keyCodes.Length >= 1 ? (VirtualKey)keyCodes[0] : VirtualKey.None; var modifiers = keyCodes.Length >= 2 ? keyCodes.Skip(1).Select(x => (VirtualKey)x).ToArray() : Array.Empty<VirtualKey>(); var result = new ShortcutKey(key, modifiers); return result; }
public ShortcutKeyPressedEventArgs(ShortcutKey shortcutKey) { this.ShortcutKey = shortcutKey; }
public bool Equals(ShortcutKey other) { return this == other; }
public HookAction(ShortcutKey shortcutKey, Action<IntPtr> action, Func<bool> canExecute) { this.ShortcutKey = shortcutKey; this.Action = action; this.CanExecute = canExecute; }
public IDisposable Register(ShortcutKey shortcutKey, Action<IntPtr> action) { return this.Register(shortcutKey, action, () => true); }
public HookAction(ShortcutKey shortcutKey, Action <IntPtr> action, Func <bool> canExecute) { this.ShortcutKey = shortcutKey; this.Action = action; this.CanExecute = canExecute; }
public IDisposable Register(ShortcutKey shortcutKey, Action <IntPtr> action) { return(this.Register(shortcutKey, action, () => true)); }
public bool Equals(ShortcutKey other) { return(this == other); }