Skip to content

Commit

Permalink
`
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliviaophia committed Mar 4, 2018
1 parent cd88a0d commit 29b7674
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions SmartTaskbar/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.Windows.Forms;

namespace SmartTaskbar
Expand All @@ -11,6 +12,8 @@ static class Program
[STAThread]
static void Main()
{
if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length > 1)
return;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
new SystemTray();
Expand Down
14 changes: 8 additions & 6 deletions SmartTaskbar/SystemTray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ public SystemTray()
{
Text = resource.GetString("exit")
};
exit.Click += (s, e) =>
{
switcher.Stop();
notifyIcon.Dispose();
Application.Exit();
};
exit.Click += Exit_Click;
contextMenuStrip = new ContextMenuStrip();
contextMenuStrip.Items.AddRange(new ToolStripItem[]
{
Expand Down Expand Up @@ -83,6 +78,13 @@ public SystemTray()
}
}

private void Exit_Click(object sender, EventArgs e)
{
switcher.Stop();
notifyIcon.Dispose();
Application.Exit();
}

private void NotifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (switcher.IsHide())
Expand Down

0 comments on commit 29b7674

Please sign in to comment.