private void Application_Exit(object sender, ExitEventArgs e) { _trayIcon.Close(); KeyboardListener.UnRegister(); AppleKeyboardHID2.Shutdown(); }
public static bool HandleKeyDown(KeyboardListener.KeyHookEventArgs e) { bool F; if (AppleWirelessKeyboard.Properties.Settings.Default.WiredKeyboard && AppleWirelessKeyboard.Properties.Settings.Default.WiredHoldEjectForFn) F = e.ModifierFn && !e.ModifierAnyNative; else F = (FMode || e.ModifierFn) && !e.ModifierAnyNative; switch (e.Key) { case Key.F3: if (F) { KeyboardControl.SendPrintScreen(); return true; } break; case Key.F4: if (F) { KeyboardControl.OpenTaskManager(); return true; } break; case Key.F2: if (F) { KeyboardControl.SendF3(); return true; } break; case Key.F7: if (F) { KeyboardControl.SendPreviousTrack(); return true; } break; case Key.F8: if (F) { KeyboardControl.SendPlayPause(); return true; } break; case Key.F9: if (F) { KeyboardControl.SendNextTrack(); return true; } break; case Key.F10: if (F) { VolumeControl.ToggleMute(); return true; } break; case Key.F11: if (F) { VolumeControl.VolumeDown(); return true; } break; case Key.F12: if (F) { VolumeControl.VolumeUp(); return true; } break; case Key.Back: if (e.ModifierFn) { KeyboardControl.SendDelete(); return true; } break; case Key.Up: if (e.ModifierFn) { KeyboardControl.SendPageUp(); return true; } break; case Key.Down: if (e.ModifierFn) { KeyboardControl.SendPageDown(); return true; } break; case Key.Left: if(e.ModifierFn) { KeyboardControl.SendHome(); return true; } break; case Key.Right: if (e.ModifierFn) { KeyboardControl.SendEnd(); return true; } break; case Key.Enter: if (e.ModifierFn) { KeyboardControl.SendInsert(); return true; } break; } if (e.ModifierAnyAlt && (FMode || e.ModifierFn)) if (e.Key == Key.F3) { KeyboardControl.SendPrintScreen(); return true; } return false; }
bool KeyboardListener_KeyDown(KeyboardListener.KeyHookEventArgs e) { return KeyboardHandler.HandleKeyDown(e); }