gray out restore snapshot menu until a snapshot is captured

This commit is contained in:
Kang Yu 2021-10-08 18:35:13 -07:00
parent b1cd8d8775
commit dfb5f87067
4 changed files with 10 additions and 0 deletions

View file

@ -134,6 +134,7 @@ namespace Ninjacrab.PersistentWindows.Common
public delegate void CallBackBool(bool en); public delegate void CallBackBool(bool en);
public CallBackBool enableRestoreMenu; public CallBackBool enableRestoreMenu;
public CallBackBool enableRestoreSnapshotMenu;
private PowerModeChangedEventHandler powerModeChangedHandler; private PowerModeChangedEventHandler powerModeChangedHandler;
private EventHandler displaySettingsChangingHandler; private EventHandler displaySettingsChangingHandler;

View file

@ -292,6 +292,8 @@ namespace Ninjacrab.PersistentWindows.SystrayShell
if (prompt) if (prompt)
systrayForm.notifyIconMain.ShowBalloonTip(5000, $"snapshot '{c}' is captured", $"click icon then immediately press key '{c}' to restore the snapshot", ToolTipIcon.Info); systrayForm.notifyIconMain.ShowBalloonTip(5000, $"snapshot '{c}' is captured", $"click icon then immediately press key '{c}' to restore the snapshot", ToolTipIcon.Info);
} }
systrayForm.EnableSnapshotRestore();
} }
static public void ChangeZorderMethod() static public void ChangeZorderMethod()

View file

@ -137,6 +137,8 @@ namespace Ninjacrab.PersistentWindows.SystrayShell
this.restoreSnapshotMenuItem.Size = new System.Drawing.Size(135, 22); this.restoreSnapshotMenuItem.Size = new System.Drawing.Size(135, 22);
this.restoreSnapshotMenuItem.Text = "R&estore snapshot"; this.restoreSnapshotMenuItem.Text = "R&estore snapshot";
this.restoreSnapshotMenuItem.Click += new System.EventHandler(this.RestoreSnapshotClickHandler); this.restoreSnapshotMenuItem.Click += new System.EventHandler(this.RestoreSnapshotClickHandler);
this.restoreSnapshotMenuItem.Enabled = false;
// suspend/resume auto restore // suspend/resume auto restore
// //
this.pauseResumeToolStripMenuItem.Name = "suspend/resume"; this.pauseResumeToolStripMenuItem.Name = "suspend/resume";

View file

@ -176,6 +176,11 @@ namespace Ninjacrab.PersistentWindows.SystrayShell
} }
} }
public void EnableSnapshotRestore()
{
restoreSnapshotMenuItem.Enabled = true;
}
private void CheckUpgrade() private void CheckUpgrade()
{ {
ServicePointManager.Expect100Continue = true; ServicePointManager.Expect100Continue = true;