private void hudKeyDownHandler(object sender, KeyEventArgs e) { TimerHud.Stop(); switch (e.KeyCode) { case Keys.Escape: toggleHudVisibility(); return; case Keys.Space: //change the cpu cap speed KeyValuePair <int, String> nextCpuMaxFrequencyPercentage = FrequencyController.GetNextFrequencyPercentage(PowerCfgController.GetMaximumPowerStatePercentage(null, PowerCfgController.GetCurrentPowerSource())); PowerCfgController.SetMaximumPowerState(null, PowerCfgController.GetCurrentPowerSource(), nextCpuMaxFrequencyPercentage.Key); repaintCpuMaxFrequencyPercentageLabels(nextCpuMaxFrequencyPercentage.Key, nextCpuMaxFrequencyPercentage.Value); break; case Keys.Right: //brightness up case Keys.OemCloseBrackets: repaintExtraControlLogoAndText( global::com.alexleekt.aideNotebook.Properties.Resources._512px_brightness, "+"); BrightnessController.IncreaseBrightness(); break; case Keys.Left: //brightness down case Keys.OemOpenBrackets: repaintExtraControlLogoAndText( global::com.alexleekt.aideNotebook.Properties.Resources._512px_brightness, "-"); BrightnessController.DecreaseBrightness(); break; case Keys.Up: //volume up case Keys.Oemplus: repaintExtraControlLogoAndText( global::com.alexleekt.aideNotebook.Properties.Resources._512px_volume, "+"); VolumeController.IncreaseVolume(); break; case Keys.Down: //volume down case Keys.OemMinus: repaintExtraControlLogoAndText( global::com.alexleekt.aideNotebook.Properties.Resources._512px_volume, "-"); VolumeController.DecreaseVolume(); break; case Keys.M: //mute case Keys.D0: repaintExtraControlLogoAndText( global::com.alexleekt.aideNotebook.Properties.Resources._512px_voume_mute, "Mute"); VolumeController.Mute(); break; } TimerHud.Start(); }
public HUD() { hkm = new HotkeyManager(); InitializeComponent(); // listen to power mode changes powersource = PowerCfgController.GetCurrentPowerSource(); SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged); setupCurrentCpuMaxFrequencyPercentageLabels(); TimerHud.Start(); }
private void toggleHudVisibility() { if (this.Visible) { this.Visible = false; TimerHud.Stop(); } else { TimerHud.Stop(); this.Visible = true; SetForegroundWindow(this.Handle); TimerHud.Start(); } }