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