-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
31 lines (29 loc) · 1.03 KB
/
Program.cs
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
using System;
using System.Threading;
using System.Windows.Forms;
namespace AudiobookshelfTray
{
internal static class Program
{
static readonly Mutex _mutex = new(true, "AudiobookshelfTray");
[STAThread]
static void Main()
{
// SetProcessDPIAware() is required to prevent text controls from being blurry on high DPI screens.
SetProcessDPIAware();
if (_mutex.WaitOne(TimeSpan.Zero, true))
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new AppTray());
_mutex.ReleaseMutex();
}
else
{
MessageBox.Show("AudiobookshelfTray is already running.\nCheck the system tray", "Audiobookshelf", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool SetProcessDPIAware();
}
}