mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-10 20:45:38 +02:00
refactor disable_webpage_commander
This commit is contained in:
parent
697e79b1ba
commit
0a6c00c3a7
2 changed files with 7 additions and 8 deletions
|
@ -21,6 +21,7 @@ namespace PersistentWindows.SystrayShell
|
|||
public static System.Drawing.Icon BusyIcon = null;
|
||||
public static System.Drawing.Icon UpdateIcon = null;
|
||||
public static string AppdataFolder = null;
|
||||
public static string DisableWebpageCommander = null;
|
||||
public static string CmdArgs;
|
||||
public static bool Gui = true;
|
||||
public static bool hotkey_window = true;
|
||||
|
@ -283,6 +284,8 @@ namespace PersistentWindows.SystrayShell
|
|||
if (!Directory.Exists(appDataFolder))
|
||||
Directory.CreateDirectory(appDataFolder);
|
||||
|
||||
DisableWebpageCommander = Path.Combine(AppdataFolder, "disable_webpage_commander");
|
||||
|
||||
// default icons
|
||||
var iconHandle = (legacy_icon ? Properties.Resources.pwIcon2: Properties.Resources.pwIcon).GetHicon();
|
||||
IdleIcon = System.Drawing.Icon.FromHandle(iconHandle);
|
||||
|
@ -380,8 +383,7 @@ namespace PersistentWindows.SystrayShell
|
|||
if (ignore_process.Length > 0)
|
||||
pwp.SetIgnoreProcess(ignore_process);
|
||||
|
||||
string disable_webpage_commander= Path.Combine(Program.AppdataFolder, "disable_webpage_commander");
|
||||
if (!File.Exists(disable_webpage_commander) && hotkey_window)
|
||||
if (!File.Exists(DisableWebpageCommander) && hotkey_window)
|
||||
HotKeyForm.Start(hotkey);
|
||||
|
||||
if (!pwp.Start(auto_restore_from_db_at_startup))
|
||||
|
|
|
@ -53,8 +53,7 @@ namespace PersistentWindows.SystrayShell
|
|||
else
|
||||
upgradeNoticeMenuItem.Text = "Enable upgrade notice";
|
||||
|
||||
string disable_webpage_commander= Path.Combine(Program.AppdataFolder, "disable_webpage_commander");
|
||||
if (File.Exists(disable_webpage_commander))
|
||||
if (File.Exists(Program.DisableWebpageCommander))
|
||||
{
|
||||
invokeWebCommander.Text = "Enable webpage commander";
|
||||
}
|
||||
|
@ -357,13 +356,11 @@ namespace PersistentWindows.SystrayShell
|
|||
|
||||
private void WebCommander(object sender, EventArgs e)
|
||||
{
|
||||
string disable_webpage_commander= Path.Combine(Program.AppdataFolder, "disable_webpage_commander");
|
||||
|
||||
if ((User32.GetKeyState(0x11) & 0x8000) != 0)
|
||||
HotKeyForm.InvokeFromMenu();
|
||||
else if (this.invokeWebCommander.Text.Contains("Disable"))
|
||||
{
|
||||
File.Create(disable_webpage_commander);
|
||||
File.Create(Program.DisableWebpageCommander);
|
||||
this.invokeWebCommander.Text = "Enable webpage commander";
|
||||
HotKeyForm.Stop();
|
||||
}
|
||||
|
@ -371,7 +368,7 @@ namespace PersistentWindows.SystrayShell
|
|||
{
|
||||
try
|
||||
{
|
||||
File.Delete(disable_webpage_commander);
|
||||
File.Delete(Program.DisableWebpageCommander);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue