-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
52 lines (45 loc) · 1.5 KB
/
Program.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
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Drawing;
namespace WindowsFormsApplication1
{
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var mainForm = new frmMain();
mainForm.trayMenu = new ContextMenu();
mainForm.trayMenu.MenuItems.Add("Hide", (sender, e) =>
{
if (mainForm.trayMenu.MenuItems[0].Text == "Show")
{
mainForm.Show();
mainForm.trayMenu.MenuItems[0].Text = "Hide";
}
else
{
mainForm.Hide();
mainForm.trayMenu.MenuItems[0].Text = "Show";
}
});
mainForm.trayMenu.MenuItems.Add("Exit", (sender, e) =>
{
mainForm.Close();
Application.Exit();
});
mainForm.trayIcon = new NotifyIcon();
mainForm.trayIcon.Text = "Esperantilo";
mainForm.trayIcon.Icon = mainForm.Icon;
mainForm.trayIcon.ContextMenu = mainForm.trayMenu;
mainForm.trayIcon.Visible = true;
Application.Run(mainForm);
}
static void OnExit(object sender, EventArgs e) {
Application.Exit();
}
}
}