-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.xaml.cs
41 lines (34 loc) · 1.01 KB
/
App.xaml.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
32
33
34
35
36
37
38
39
40
41
using System.Diagnostics;
using System.Windows;
using DeadEye.Helpers;
using DeadEye.Hotkeys;
namespace DeadEye;
public partial class App : IDisposable
{
private SingleInstanceHelper? _singleInstanceHelper;
public void Dispose()
{
this._singleInstanceHelper?.Dispose();
HotkeyManager.Shared.Dispose();
}
private void App_OnStartup(object sender, StartupEventArgs e)
{
this._singleInstanceHelper = new SingleInstanceHelper("DeadEye");
if (this._singleInstanceHelper.IsOtherInstanceRunning())
{
MessageBox.Show("There's already a running instance of DeadEye.", "Instance already running", MessageBoxButton.OK, MessageBoxImage.Warning);
this.Shutdown();
}
for (var i = 0; i < Screen.AllScreens.Length; i++)
{
var screen = Screen.AllScreens[i];
var isPrimary = screen.IsPrimary ? "*" : "";
Debug.WriteLine($"[{i}{isPrimary}] {screen}");
}
}
private void App_OnSessionEnding(object sender, SessionEndingCancelEventArgs e)
{
// make sure the app shuts down cleanly
this.Shutdown();
}
}