-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
66 lines (63 loc) · 2.44 KB
/
Copy pathProgram.cs
File metadata and controls
66 lines (63 loc) · 2.44 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using PingRadar.Application.Diagnostics;
using PingRadar.Application.Relays;
using PingRadar.Infrastructure.Diagnostics;
using PingRadar.Infrastructure.Lifecycle;
using PingRadar.Infrastructure.Persistence;
using PingRadar.Infrastructure.Steam;
using PingRadar.Infrastructure.Updates;
using PingRadar.Presentation.Forms;
namespace PingRadar
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
using var singleInstance = new WindowsSingleInstanceCoordinator();
if (!singleInstance.IsPrimaryInstance)
{
singleInstance.SignalPrimaryInstance();
return;
}
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
var settingsStore = new AppSettingsStore();
var relayCatalog = new RelayCatalogService(new SteamRelayClient());
var relayProbeService = new RelayProbeService(RelayProbeOptions.Default);
var updateService = new GitHubUpdateService();
var updateStateStore = new UpdateStateStore();
var updateInstallerLauncher = new InnoUpdateInstallerLauncher();
var updateSessionCoordinator = new UpdateSessionCoordinator();
using var mainForm = new MainForm(
settingsStore,
relayCatalog,
relayProbeService,
updateService,
updateStateStore,
updateInstallerLauncher,
updateSessionCoordinator);
mainForm.Shown += (_, _) =>
singleInstance.StartListening(() =>
{
if (mainForm.IsDisposed || !mainForm.IsHandleCreated)
{
return;
}
try
{
_ = mainForm.BeginInvoke(
new Action(mainForm.ActivateExistingInstance));
}
catch (InvalidOperationException)
{
// The main window is already shutting down.
}
});
System.Windows.Forms.Application.Run(mainForm);
}
}
}