changes
This commit is contained in:
@@ -38,6 +38,10 @@ namespace ModVersionChecker
|
||||
{
|
||||
Console.WriteLine("Application is shutting down...");
|
||||
});
|
||||
lifetime.ApplicationStopping.Register(() =>
|
||||
{
|
||||
Console.WriteLine("Application is shutting down...");
|
||||
});
|
||||
|
||||
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
||||
Application.EnableVisualStyles();
|
||||
@@ -78,7 +82,13 @@ namespace ModVersionChecker
|
||||
|
||||
var contextMenu = new ContextMenuStrip();
|
||||
contextMenu.Items.Add("Configure", null, openFormHandler);
|
||||
contextMenu.Items.Add("Exit", null, (s, e) => Application.Exit());
|
||||
contextMenu.Items.Add("Exit", null, (s, e) =>
|
||||
{
|
||||
notifyIcon.Visible = false;
|
||||
Application.Exit();
|
||||
lifetime.StopApplication();
|
||||
//host.StopAsync().GetAwaiter().GetResult();
|
||||
});
|
||||
notifyIcon.ContextMenuStrip = contextMenu;
|
||||
|
||||
notifyIcon.DoubleClick += openFormHandler;
|
||||
@@ -117,23 +127,16 @@ namespace ModVersionChecker
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add to startup
|
||||
// AddToStartup();
|
||||
|
||||
host.Start();
|
||||
|
||||
Application.Run(); // Keep app running for tray icon
|
||||
|
||||
host.StopAsync().GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
host.RunAsync().GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
static void AddToStartup()
|
||||
{
|
||||
using (var key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true))
|
||||
{
|
||||
key?.SetValue("XintanalabsUpdateChecker", $"\"{Application.ExecutablePath}\"");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user