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