-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathProgram.cs
More file actions
36 lines (31 loc) · 1.26 KB
/
Program.cs
File metadata and controls
36 lines (31 loc) · 1.26 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
namespace DesktopIconToggle;
static class Program
{
private const string MutexName = "Global\\DesktopIconToggle_370A329E-902E-4B19-A164-34D43A1F5014";
[STAThread]
static void Main()
{
using (System.Threading.Mutex mutex = new System.Threading.Mutex(false, MutexName, out bool createdNew)) {
if (!createdNew)
{
MessageBox.Show("An instance of DesktopIconToggle is already running in the background. To pause or exit, right-click it's icon in the system tray.",
"DesktopIconToggle is already running",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
return;
}
try
{
ApplicationConfiguration.Initialize();
Application.Run(new TrayApplicationContext());
}
catch (Exception ex)
{
MessageBox.Show($"Fatal Error during startup:\n\n{ex.Message}\n\n{ex.StackTrace}",
"[DesktopIconToggle] Application Crash",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
}