Widow – Diff between revs 6 and 19
?pathlinks?
Rev 6 | Rev 19 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
1 | using System; |
1 | using System; |
|
- | 2 | using System.Threading; |
||
2 | using System.Windows.Forms; |
3 | using System.Windows.Forms; |
|
Line 3... | Line 4... | |||
3 | |
4 | |
|
4 | namespace Widow |
5 | namespace Widow |
|
5 | { |
6 | { |
|
6 | internal class Program : IDisposable |
7 | internal class Program : IDisposable |
|
7 | { |
8 | { |
|
Line -... | Line 9... | |||
- | 9 | #region Static Fields and Constants |
||
- | 10 | |
||
8 | #region Static Fields and Constants |
11 | private static readonly Mutex Mutex = new Mutex(true, Constants.AssemblyGuid); |
|
Line 9... | Line 12... | |||
9 | |
12 | |
|
Line 10... | Line 13... | |||
10 | private static Form _form; |
13 | private static Form _form; |
|
Line 27... | Line 30... | |||
27 | /// The main entry point for the application. |
30 | /// The main entry point for the application. |
|
28 | /// </summary> |
31 | /// </summary> |
|
29 | [STAThread] |
32 | [STAThread] |
|
30 | private static void Main() |
33 | private static void Main() |
|
31 | { |
34 | { |
|
32 | Application.EnableVisualStyles(); |
35 | if (Mutex.WaitOne(TimeSpan.Zero, true)) |
|
- | 36 | { |
||
33 | Application.SetCompatibleTextRenderingDefault(false); |
37 | Application.SetCompatibleTextRenderingDefault(false); |
|
34 | _form = new MainForm(); |
38 | _form = new MainForm(); |
|
35 | Application.Run(); |
39 | Application.Run(); |
|
- | 40 | Mutex.ReleaseMutex(); |
||
- | 41 | return; |
||
- | 42 | } |
||
- | 43 | |
||
- | 44 | // Foreground current other application window. |
||
- | 45 | Natives.PostMessage( |
||
- | 46 | (IntPtr) Natives.HWND_BROADCAST, |
||
- | 47 | Natives.WM_SHOWME, |
||
- | 48 | IntPtr.Zero, |
||
- | 49 | IntPtr.Zero); |
||
36 | } |
50 | } |
|
Line 37... | Line 51... | |||
37 | |
51 | |
|
38 | #endregion |
52 | #endregion |
|
39 | } |
53 | } |
|
40 | } |
54 | } |