Widow – Blame information for rev 19
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | using System; |
19 | office | 2 | using System.Threading; |
1 | office | 3 | using System.Windows.Forms; |
4 | |||
5 | namespace Widow |
||
6 | { |
||
7 | internal class Program : IDisposable |
||
8 | { |
||
9 | #region Static Fields and Constants |
||
10 | |||
19 | office | 11 | private static readonly Mutex Mutex = new Mutex(true, Constants.AssemblyGuid); |
12 | |||
1 | office | 13 | private static Form _form; |
14 | |||
15 | #endregion |
||
16 | |||
17 | #region Constructors, Destructors and Finalizers |
||
18 | |||
19 | public void Dispose() |
||
20 | { |
||
21 | _form?.Dispose(); |
||
22 | _form = null; |
||
23 | } |
||
24 | |||
25 | #endregion |
||
26 | |||
27 | #region Private Methods |
||
28 | |||
29 | /// <summary> |
||
30 | /// The main entry point for the application. |
||
31 | /// </summary> |
||
32 | [STAThread] |
||
33 | private static void Main() |
||
34 | { |
||
19 | office | 35 | if (Mutex.WaitOne(TimeSpan.Zero, true)) |
36 | { |
||
37 | Application.SetCompatibleTextRenderingDefault(false); |
||
38 | _form = new MainForm(); |
||
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); |
||
1 | office | 50 | } |
51 | |||
52 | #endregion |
||
53 | } |
||
54 | } |