-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
41 lines (36 loc) · 1.22 KB
/
Copy pathProgram.cs
File metadata and controls
41 lines (36 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
37
38
39
40
41
using Rounder.Windows;
internal static class Program
{
[STAThread]
private static void Main(string[] args)
{
var launchedInBackground = args.Any(arg => string.Equals(arg, "--background", StringComparison.OrdinalIgnoreCase));
using var singleInstance = new SingleInstanceManager();
if (!singleInstance.IsFirstInstance)
{
if (!launchedInBackground)
{
singleInstance.SignalActivate();
}
return;
}
System.Windows.Forms.Application.SetHighDpiMode(HighDpiMode.PerMonitorV2);
ApplicationConfiguration.Initialize();
EnsureWpfApplication();
using var context = new RounderApplicationContext(launchedInBackground);
singleInstance.StartListening(context.ActivateFromSecondaryInstance);
System.Windows.Forms.Application.Run(context);
}
private static void EnsureWpfApplication()
{
if (System.Windows.Application.Current is not null)
{
return;
}
_ = new System.Windows.Application
{
ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown,
ThemeMode = System.Windows.ThemeMode.System
};
}
}