コード例 #1
0
 internal RawInputKeyboardEventArgs(RawKeyboardDevice device, KeyPressState keyPressState, uint message, Key key, int virtualKey)
 {
     Device        = device;
     KeyPressState = keyPressState;
     Message       = message;
     Key           = key;
     VirtualKey    = virtualKey;
 }
コード例 #2
0
 internal RawInputEventArgs(RawKeyboardDevice device, KeyPressState keyPressState, uint message, Key key,
     int virtualKey)
 {
     Device = device;
     KeyPressState = keyPressState;
     Message = message;
     Key = key;
     VirtualKey = virtualKey;
 }
コード例 #3
0
 internal RawKeyEventArgs(IntPtr device, KeyPressState keyPressState, uint message, Key key,
                          int virtualKey)
 {
     Device        = device;
     KeyPressState = keyPressState;
     Message       = message;
     Key           = key;
     VirtualKey    = virtualKey;
 }
コード例 #4
0
 /// <summary>
 /// Key pressed event.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="keyId">Key id as per Qt mappings: https://doc.qt.io/qt-5/qt.html#Key-enum </param>
 /// <param name="keyState">Pressed or Released</param>
 /// <param name="modifiers">Modifier bits as per Qt mappings: https://doc.qt.io/qt-5/qt.html#KeyboardModifier-enum </param>
 public KeyPressedEventResult(
     IItem item,
     int keyId,
     KeyPressState keyState,
     int modifiers)
     : base(EventType.KeyPressed, item)
 {
     KeyId     = keyId;
     KeyState  = keyState;
     Modifiers = modifiers;
 }
コード例 #5
0
 /// <summary>
 /// Allows the containing window to tell the engine about key press events.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="state"></param>
 public void KeyStateChanged(PlayerKey key, KeyPressState state, Keys?other = null)
 {
     if (_keyStates.ContainsKey(key))
     {
         _keyStates[key] = state;
     }
     else
     {
         _keyStates.Add(key, state);
     }
 }
コード例 #6
0
        private async Task HandleKeyPressAsync(KeyPressState state, int vKey)
        {
            if (isAdminProcess)
            {
                if (!ProcessHelper.IsForegroundProcessAdmin())
                {
                    return;
                }
            }

            bool success = await pipeClient.Send($"{(int)state} {vKey}");

            if (!success)
            {
                NEHHook.StopHook();
                Environment.Exit(1);
            }
            await Task.Delay(0);
        }
コード例 #7
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            using (GlobalKeyboardHook ghk = new GlobalKeyboardHook())
            {
                JsonConfigProvider optionsProvider = new JsonConfigProvider(GetConfigFileName());
                configData = optionsProvider.Load();

                //TODO: Load this from configData
                var kps = new KeyPressState()
                {
                    IsCtrl = true,
                    Key    = Keys.Oemtilde
                };

                Instance             = new TrayBasedContext(Resources.AppIcon, kps, optionsProvider);
                ghk.KeyboardPressed += Instance.HandleKey;

                Application.Run(Instance);
            }
        }