Represents a shortcut key ([modifer key(s)] + [key] style).
Exemple #1
0
        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));
        }
Exemple #2
0
        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 ShortcutKeyPressedEventArgs(ShortcutKey shortcutKey)
 {
     this.ShortcutKey = shortcutKey;
 }
Exemple #6
0
 public bool Equals(ShortcutKey other)
 {
     return this == other;
 }
Exemple #7
0
 public HookAction(ShortcutKey shortcutKey, Action<IntPtr> action, Func<bool> canExecute)
 {
     this.ShortcutKey = shortcutKey;
     this.Action = action;
     this.CanExecute = canExecute;
 }
Exemple #8
0
 public IDisposable Register(ShortcutKey shortcutKey, Action<IntPtr> action)
 {
     return this.Register(shortcutKey, action, () => true);
 }
Exemple #9
0
 public HookAction(ShortcutKey shortcutKey, Action <IntPtr> action, Func <bool> canExecute)
 {
     this.ShortcutKey = shortcutKey;
     this.Action      = action;
     this.CanExecute  = canExecute;
 }
Exemple #10
0
 public IDisposable Register(ShortcutKey shortcutKey, Action <IntPtr> action)
 {
     return(this.Register(shortcutKey, action, () => true));
 }
Exemple #11
0
 public bool Equals(ShortcutKey other)
 {
     return(this == other);
 }