-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.xaml.cs
50 lines (43 loc) · 1.27 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
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using Forms = System.Windows.Forms;
namespace Maid
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private readonly Forms.NotifyIcon _notifyIcon;
public App()
{
_notifyIcon = new Forms.NotifyIcon();
}
protected override void OnStartup(StartupEventArgs e)
{
_notifyIcon.Icon =new System.Drawing.Icon("images/dm.ico");
_notifyIcon.Text = "Desktop Maid";
_notifyIcon.Visible = true;
_notifyIcon.ContextMenu = new Forms.ContextMenu();
_notifyIcon.ContextMenu.MenuItems.Add("Exit",new EventHandler(Quit));
base.OnStartup(e);
}
private void Quit(object sender,EventArgs e)
{
_notifyIcon.Visible = false;
_notifyIcon.Dispose();
Environment.Exit(0);
}
protected override void OnExit(ExitEventArgs e)
{
_notifyIcon.Visible = false;
_notifyIcon.Dispose();
base.OnExit(e);
}
}
}