Esempio n. 1
0
		private void InterceptorOnKeyDown(object sender, System.Windows.Forms.KeyEventArgs args)
		{
			var key = KeyInterop.KeyFromVirtualKey((int)args.KeyCode);

			if (key.IsModifyKey())
			{
				this.pressedModifiers.Add(key);
			}
			else if (this.pressedModifiers.Count > 0 || !this.RequireModifier)
			{
				var shortcut = new ShortcutKeyPressedEventArgs(new ShortcutKey(key, new HashSet<Key>(this.pressedModifiers)));
				this.keySubject.OnNext(shortcut);
				args.SuppressKeyPress = shortcut.Handled;
			}
		}
Esempio n. 2
0
        private void InterceptorOnKeyDown(object sender, System.Windows.Forms.KeyEventArgs args)
        {
            var key = KeyInterop.KeyFromVirtualKey((int)args.KeyCode);

            if (key.IsModifyKey())
            {
                this.pressedModifiers.Add(key);
            }
            else if (this.pressedModifiers.Count > 0 || !this.RequireModifier)
            {
                var shortcut = new ShortcutKeyPressedEventArgs(new ShortcutKey(key, new HashSet <Key>(this.pressedModifiers)));
                this.keySubject.OnNext(shortcut);
                args.SuppressKeyPress = shortcut.Handled;
            }
        }