-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs.bak
More file actions
38 lines (31 loc) · 949 Bytes
/
Program.cs.bak
File metadata and controls
38 lines (31 loc) · 949 Bytes
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
using Application = System.Windows.Application;
using System.Windows;
public partial class App : Application
{
private ConfigManager _config = null!;
private NotifyIconManager? _trayIcon;
protected override void OnStartup(StartupEventArgs e)
{
_config = ConfigManager.Load();
if (_config.StartWithSystem)
AutoStartManager.SetAutoStart(true);
var mainWindow = new MainWindow(_config);
_trayIcon = new NotifyIconManager(mainWindow);
mainWindow.Closed += (s, e) =>
{
_trayIcon?.Dispose();
Shutdown();
};
if (_config.AutoConnect && _config.LastConfig != null)
{
mainWindow.Show();
mainWindow.WindowState = WindowState.Minimized;
_ = mainWindow.ConnectAsync(_config.LastConfig);
}
else
{
mainWindow.Show();
}
base.OnStartup(e);
}
}