Winify – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | using System; |
2 | using System.Threading; |
||
3 | using System.Windows.Forms; |
||
4 | |||
5 | namespace Winify |
||
6 | { |
||
7 | internal class Program : IDisposable |
||
8 | { |
||
9 | #region Static Fields and Constants |
||
10 | |||
11 | private static readonly Mutex Mutex = new Mutex(true, Constants.AssemblyGuid); |
||
12 | |||
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 | { |
||
35 | if (Mutex.WaitOne(TimeSpan.Zero, true)) |
||
36 | { |
||
37 | Application.EnableVisualStyles(); |
||
38 | Application.SetCompatibleTextRenderingDefault(false); |
||
39 | _form = new Form1(); |
||
40 | Application.Run(); |
||
41 | Mutex.ReleaseMutex(); |
||
42 | return; |
||
43 | } |
||
44 | |||
45 | // Foreground current other application window. |
||
46 | Natives.PostMessage( |
||
47 | (IntPtr) Natives.HWND_BROADCAST, |
||
48 | Natives.WM_SHOWME, |
||
49 | IntPtr.Zero, |
||
50 | IntPtr.Zero); |
||
51 | } |
||
52 | |||
53 | #endregion |
||
54 | } |
||
55 | } |