[exe] Open menu item is clickable after the server is ready
This commit is contained in:
parent
fee8fd9320
commit
bba8c6fe4e
|
@ -42,6 +42,7 @@ namespace UptimeKuma {
|
||||||
|
|
||||||
private MenuItem statusMenuItem;
|
private MenuItem statusMenuItem;
|
||||||
private MenuItem runWhenStarts;
|
private MenuItem runWhenStarts;
|
||||||
|
private MenuItem openMenuItem;
|
||||||
|
|
||||||
private RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
|
private RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
|
||||||
|
|
||||||
|
@ -57,10 +58,13 @@ namespace UptimeKuma {
|
||||||
statusMenuItem = new MenuItem(startingText);
|
statusMenuItem = new MenuItem(startingText);
|
||||||
statusMenuItem.Enabled = false;
|
statusMenuItem.Enabled = false;
|
||||||
|
|
||||||
|
openMenuItem = new MenuItem("Open", Open);
|
||||||
|
openMenuItem.Enabled = false;
|
||||||
|
|
||||||
trayIcon.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
|
trayIcon.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
|
||||||
trayIcon.ContextMenu = new ContextMenu(new MenuItem[] {
|
trayIcon.ContextMenu = new ContextMenu(new MenuItem[] {
|
||||||
statusMenuItem,
|
statusMenuItem,
|
||||||
new("Open", Open),
|
openMenuItem,
|
||||||
//new("Debug Console", DebugConsole),
|
//new("Debug Console", DebugConsole),
|
||||||
runWhenStarts,
|
runWhenStarts,
|
||||||
new("Check for Update...", CheckForUpdate),
|
new("Check for Update...", CheckForUpdate),
|
||||||
|
@ -131,6 +135,7 @@ namespace UptimeKuma {
|
||||||
try {
|
try {
|
||||||
tcpClient.Connect("127.0.0.1", 3001);
|
tcpClient.Connect("127.0.0.1", 3001);
|
||||||
statusMenuItem.Text = runningText;
|
statusMenuItem.Text = runningText;
|
||||||
|
openMenuItem.Enabled = true;
|
||||||
trayIcon.Text = runningText;
|
trayIcon.Text = runningText;
|
||||||
break;
|
break;
|
||||||
} catch (Exception) {
|
} catch (Exception) {
|
||||||
|
|
Loading…
Reference in New Issue