diff --git a/SmartTaskbar/Program.cs b/SmartTaskbar/Program.cs index b78cdd5..347e730 100644 --- a/SmartTaskbar/Program.cs +++ b/SmartTaskbar/Program.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Windows.Forms; namespace SmartTaskbar @@ -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(); diff --git a/SmartTaskbar/SystemTray.cs b/SmartTaskbar/SystemTray.cs index 790098c..86ce6f3 100644 --- a/SmartTaskbar/SystemTray.cs +++ b/SmartTaskbar/SystemTray.cs @@ -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[] { @@ -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())