-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyApplicationContext.cs
43 lines (33 loc) · 1.05 KB
/
MyApplicationContext.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
42
43
using System;
using System.Drawing;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace busylight_client
{
class MyApplicationContext : ApplicationContext
{
private NotifyIcon TrayIcon;
public Settings Settings;
public ContextMenuStrip Menu;
public MyApplicationContext()
{
Settings = new Settings();
Menu = new MenuGenerator(Settings).Menu;
Application.ApplicationExit += (object sender, EventArgs e) => { TrayIcon.Visible = false; };
InitializeComponent();
TrayIcon.Visible = true;
}
private void InitializeComponent()
{
TrayIcon = new NotifyIcon
{
Icon = Settings.resourceSet.GetObject("icon") as Icon,
ContextMenuStrip = Menu,
Text = "Busylight client",
Visible = true
};
var serverConnect = new ServerConnect(Settings, Menu);
Task.Run(() => serverConnect.Connect());
}
}
}