private static IntPtr HwndHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { switch (msg) { case WmHotkey: switch (wParam.ToInt32()) { case HotkeyId: OnHotkeyPressed?.Invoke(); handled = true; break; case EscapeHotkeyId: OnEscapePressed?.Invoke(); handled = true; break; } break; } return(IntPtr.Zero); }
/// <summary> /// Action that will be invoked on needed thread via dispatcher. /// </summary> /// <SecurityNote> /// Don't invoke explicitly. /// Event must be checked before. /// </SecurityNote> private void DispatchedAction() { OnHotkeyPressed.Invoke(_holdedModifier, _holdedKeyWPF); }