Skip to content

Commit

Permalink
Allow only one instance
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrondeau committed Jul 25, 2014
1 parent cd761f7 commit d15bd0a
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions GoToWindow/Program.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
using System;
using System.Threading;
using System.Windows.Forms;

namespace GoToWindow
{
static class Program
internal static class Program
{
[STAThread]
static void Main()
private static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new GoToWindowApplicationContext());
bool createdNew;
using (new Mutex(true, "GoToWindow", out createdNew))
{
if (!createdNew) return;

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new GoToWindowApplicationContext());
}
}
}
}

0 comments on commit d15bd0a

Please sign in to comment.