From 169e694684006f9cd3db047b7cc54b2224e919ac Mon Sep 17 00:00:00 2001 From: Kang Yu Date: Wed, 26 Jun 2024 16:47:13 -0700 Subject: [PATCH] #331, toggle menu between Enable/Disable webpage commander --- .../Common/HotKeyWindow.cs | 1 + .../SystrayShell/Program.cs | 2 +- .../SystrayShell/SystrayForm.Designer.cs | 2 +- .../SystrayShell/SystrayForm.cs | 10 +++++++--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Ninjacrab.PersistentWindows.Solution/Common/HotKeyWindow.cs b/Ninjacrab.PersistentWindows.Solution/Common/HotKeyWindow.cs index ae4a091..760d5a3 100644 --- a/Ninjacrab.PersistentWindows.Solution/Common/HotKeyWindow.cs +++ b/Ninjacrab.PersistentWindows.Solution/Common/HotKeyWindow.cs @@ -43,6 +43,7 @@ namespace PersistentWindows.Common public HotKeyWindow(uint hkey) { + init = true; hotkey = hkey; InitializeComponent(); diff --git a/Ninjacrab.PersistentWindows.Solution/SystrayShell/Program.cs b/Ninjacrab.PersistentWindows.Solution/SystrayShell/Program.cs index 5a1181a..bb2e1ce 100644 --- a/Ninjacrab.PersistentWindows.Solution/SystrayShell/Program.cs +++ b/Ninjacrab.PersistentWindows.Solution/SystrayShell/Program.cs @@ -24,6 +24,7 @@ namespace PersistentWindows.SystrayShell public static string CmdArgs; public static bool Gui = true; public static bool hotkey_window = true; + public static uint hotkey = 'W'; //Alt + W private const int MaxSnapshots = 38; // 0-9, a-z, ` and final one for undo @@ -74,7 +75,6 @@ namespace PersistentWindows.SystrayShell bool auto_upgrade = false; bool legacy_icon = false; bool waiting_taskbar = false; - uint hotkey = 'W'; //Alt + W foreach (var arg in args) { diff --git a/Ninjacrab.PersistentWindows.Solution/SystrayShell/SystrayForm.Designer.cs b/Ninjacrab.PersistentWindows.Solution/SystrayShell/SystrayForm.Designer.cs index 29b62b7..a2ebe39 100644 --- a/Ninjacrab.PersistentWindows.Solution/SystrayShell/SystrayForm.Designer.cs +++ b/Ninjacrab.PersistentWindows.Solution/SystrayShell/SystrayForm.Designer.cs @@ -154,7 +154,7 @@ namespace PersistentWindows.SystrayShell // web commander this.invokeWebCommander.Name = "web commander on/off"; - this.invokeWebCommander.Text = "Turn off webpage commander"; + this.invokeWebCommander.Text = "Disable webpage commander"; this.invokeWebCommander.Click += new System.EventHandler(this.WebCommander); if (!Program.hotkey_window) this.invokeWebCommander.Visible = false; diff --git a/Ninjacrab.PersistentWindows.Solution/SystrayShell/SystrayForm.cs b/Ninjacrab.PersistentWindows.Solution/SystrayShell/SystrayForm.cs index bfb86e1..6f62633 100644 --- a/Ninjacrab.PersistentWindows.Solution/SystrayShell/SystrayForm.cs +++ b/Ninjacrab.PersistentWindows.Solution/SystrayShell/SystrayForm.cs @@ -343,11 +343,15 @@ namespace PersistentWindows.SystrayShell { if ((User32.GetKeyState(0x11) & 0x8000) != 0) HotKeyForm.InvokeFromMenu(); + else if (this.invokeWebCommander.Text.Contains("Disable")) + { + this.invokeWebCommander.Text = "Enable webpage commander"; + HotKeyForm.Stop(); + } else { - //this.invokeWebCommander.Enabled = false; - this.invokeWebCommander.Visible = false; - HotKeyForm.Stop(); + this.invokeWebCommander.Text = "Disable webpage commander"; + HotKeyForm.Start(Program.hotkey); } }