/// <summary>Initialize the right click menu</summary> private void InitializeContextMenu() { toolStripMenuItemChannelUp.Click += (sender, args) => TvCore.ChangeChannel(true); toolStripMenuItemChannelDown.Click += (sender, args) => TvCore.ChangeChannel(false); toolStripMenuItemWindowState.Click += (sender, args) => ToggleVisibility(); toolStripMenuItemMute.Click += (sender, args) => ToggleMute(); toolStripMenuItemStatusBar.Click += (sender, args) => ToggleStatusStrip(); toolStripMenuItemClosedCaptioning.Click += (sender, args) => ToggleClosedCaptioning(); toolStripMenuItemBorders.Click += (sender, args) => ToggleBorders(); toolStripMenuItemFullscreen.Click += (sender, args) => FullscreenSet(!TvCore.Settings.Fullscreen); toolStripMenuItemAlwaysOnTop.Click += (sender, args) => ToggleAlwaysOnTop(); toolStripMenuItemGuide.Click += (sender, args) => ToggleGuideForm(); toolStripMenuItemChannelEditor.Click += (sender, args) => ToggleChannelsForm(); toolStripMenuItemAbout.Click += (sender, args) => _aboutForm.ShowDialog(this); toolStripMenuItemQuit.Click += (sender, args) => Quit(); }
/// <summary>The KeyUp handler for hot keys</summary> /// <param name="sender">The object that triggered the event</param> /// <param name="e">The event arguments</param> private void TvForm_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Z) { Opacity -= .1; if (Opacity < 0) { Opacity = 0; } TvCore.LogDebug($"[.NET] Opacity Set {Opacity}"); } if (e.KeyCode == Keys.X) { Opacity += .1; if (Opacity > 1) { Opacity = 1; } TvCore.LogDebug($"[.NET] Opacity Set {Opacity}"); } if (e.KeyCode == Keys.B) { ToggleBorders(); } if (e.KeyCode == Keys.A) { ToggleAlwaysOnTop(); } if (e.KeyCode == Keys.F) { ToggleFullscreen(); } if (e.KeyCode == Keys.S) { ToggleStatusStrip(); } if (e.KeyCode == Keys.I) { GuiShow(); } if (e.KeyCode == Keys.H) { ToggleVisibility(); } if (e.KeyCode == Keys.G) { ToggleGuideForm(); } if (e.KeyCode == Keys.T) { ToggleChannelsForm(); } if (e.KeyCode == Keys.PageUp || e.KeyCode == Keys.PageDown) { TvCore.ChangeChannel(e.KeyCode == Keys.PageUp); } if (e.KeyCode == Keys.Space) { ToggleMute(); } if (e.KeyCode == Keys.C) { ToggleClosedCaptioning(); } if (e.KeyCode == Keys.Enter && _numberEntryMode) { _numberEntryModeTimeout = 1; } if (e.KeyCode == Keys.Back && _numberEntryMode && _numberEntryDigits.Count > 0) { if (_numberEntryDigits.Count == 1) { _numberEntryMode = false; _numberEntryModeTimeout = 0; _numberEntryDigits.Clear(); GuiHide(); } else { _numberEntryModeTimeout = 20; _numberEntryDigits.RemoveAt(_numberEntryDigits.Count - 1); GuiShow(); } } if (e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9 || e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9) { var digitPressed = e.KeyCode - (e.KeyCode < Keys.NumPad0 ? Keys.D0 : Keys.NumPad0); if (!_numberEntryMode) { _numberEntryMode = true; } _numberEntryModeTimeout = 20; _numberEntryDigits.Add(digitPressed); GuiShow(); } }