private static void CheckHotkeys()
 {
     if (RequiresModifierKey)
     {
         if (Keyboard.Modifiers != ModifierKeys.None)
         {
             foreach (GlobalHotkey hotkey in Hotkeys)
             {
                 if (Keyboard.Modifiers == hotkey.Modifier && Keyboard.IsKeyDown(hotkey.Key))
                 {
                     hotkey.Callback?.Invoke();
                     HotkeyFired?.Invoke(hotkey);
                 }
             }
         }
     }
     else
     {
         foreach (GlobalHotkey hotkey in Hotkeys)
         {
             if (Keyboard.Modifiers == hotkey.Modifier && Keyboard.IsKeyDown(hotkey.Key))
             {
                 hotkey.Callback?.Invoke();
                 HotkeyFired?.Invoke(hotkey);
             }
         }
     }
 }
Exemple #2
0
 private IntPtr HwndHook(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam, ref bool handled)
 {
     if (msg == NativeMethods.WM_HOTKEY)
     {
         HotkeyFired?.Invoke(this, wparam.ToInt32());
     }
     return(IntPtr.Zero);
 }
Exemple #3
0
        void HandleHotkeyMessage(WindowMessageReceivedArgument e)
        {
            if (!isInstalled)
            {
                return;
            }

            var interception = GetInterceptionForInterceptionId((int)e.WordParameter);

            if (interception != null)
            {
                HotkeyFired?.Invoke(
                    this,
                    new HotkeyFiredArgument(
                        interception.Key,
                        interception.ControlKeyNeeded));
            }
        }
Exemple #4
0
        void HandleHotkeyMessage()
        {
            if (!IsEnabled)
            {
                logger.Information("Skipped paste hotkey message because the interceptor is disabled.");
                return;
            }

            if (shouldSkipNext)
            {
                shouldSkipNext = false;
                return;
            }

            logger.Information("Paste hotkey message received.", 1);

            HotkeyFired?.Invoke(
                this,
                new HotkeyFiredArgument(
                    hotkeyInterception.KeyCode,
                    hotkeyInterception.ControlNeeded));
        }