-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathProgram.cs
36 lines (35 loc) · 1.24 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
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace GeDoSaToTool
{
static class Program
{
static Mutex mutex = new Mutex(true, "{A9A841C4-9B1A-4EA2-A174-01E2B8038BB3}");
[STAThread]
static void Main(string[] args)
{
Directory.SetCurrentDirectory(Path.GetDirectoryName(Application.ExecutablePath));
if(mutex.WaitOne(TimeSpan.Zero, true)) {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
bool autoActivate = !args.Contains("-a");
bool startMinimized = args.Contains("-m");
Application.Run(new MainForm(autoActivate, startMinimized));
mutex.ReleaseMutex();
} else {
// send our Win32 message to make the currently running instance
// jump on top of all the other windows
Native.PostMessage(
(IntPtr)Native.HWND_BROADCAST,
Native.WM_SHOWME,
IntPtr.Zero,
IntPtr.Zero);
}
}
}
}