private void HkListener_HotkeyEvent(object sender, HotkeyListener.HotkeyEventArgs e) { switch(e.Hotkey) { case Hotkey.EasySettings: ShowOSD(Hotkey.EasySettings); break; case Hotkey.ScreenBrightnessDown: ScreenBrightnessDown(); break; case Hotkey.ScreenBrightnessUp: ScreenBrightnessUp(); break; case Hotkey.DisplaySwitch: SwitchDisplayModes(); break; case Hotkey.TouchpadDisabled: ShowOSD(Hotkey.TouchpadDisabled); break; case Hotkey.TouchpadEnabled: ShowOSD(Hotkey.TouchpadEnabled); break; case Hotkey.VolumeMute: case Hotkey.VolumeDown: case Hotkey.VolumeUp: ShowVolumeOSD(e.Hotkey, e.IsKeyRelease); break; case Hotkey.KeyboardBacklightDown: KbBacklightDown(); break; case Hotkey.KeyboardBacklightUp: KbBacklightUp(); break; case Hotkey.CoolingMode: CyclePowerPlan(); break; case Hotkey.ToggleWireless: ToggleWireless(); break; case Hotkey.FnLockDisabled: ShowOSD(Hotkey.FnLockDisabled); break; case Hotkey.FnLockEnabled: ShowOSD(Hotkey.FnLockEnabled); break; case Hotkey.EjectODD: if (!e.IsKeyRelease) EjectODD(); break; default: Debug.WriteLine(e.Hotkey + " Hotkey Event: vkcode=" + e.LowLevelEvent.VkCode + "; scancode=" + e.LowLevelEvent.ScanCode + "; flags=" + e.LowLevelEvent.Flags + "; extra=" + e.LowLevelEvent.ExtraInfo + "; timestamp=" + e.LowLevelEvent.Timestamp); ShowOSD(Hotkey.Unknown, (int)e.LowLevelEvent.ScanCode); break; } }
public HotkeyManager(Dispatcher dispatcher) { mDispatcher = dispatcher; biosIface = new Controls.SamsungBIOSInterface(); hkListener = new HotkeyListener(biosIface.BIOSModelName); hkListener.SendUnknownKeyEvents = true; hkListener.HotkeyEvent += HkListener_HotkeyEvent; }