-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
36 lines (32 loc) · 1.22 KB
/
Copy pathProgram.cs
File metadata and controls
36 lines (32 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Threading;
using System.Windows.Forms;
using HamstuffAgcGuard.Logging;
namespace HamstuffAgcGuard
{
internal static class Program
{
[STAThread]
private static void Main()
{
using var singleInstanceMutex = new Mutex(true, "Global\\HamstuffAgcGuard_SingleInstance", out bool createdNew);
if (!createdNew)
{
MessageBox.Show(
"Hamstuff AGC Guard is already running. Look for its icon in the system tray.",
"Hamstuff AGC Guard",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
return;
}
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ThreadException += (_, e) =>
Logger.Error("Unhandled UI thread exception.", e.Exception);
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
Logger.Error("Unhandled exception.", e.ExceptionObject as Exception);
Application.Run(new TrayApplicationContext());
}
}
}