Winify – Blame information for rev 8

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 using System;
2 using System.Threading;
3 using System.Windows.Forms;
8 office 4 using Winify.Utilities;
1 office 5  
6 namespace Winify
7 {
8 internal class Program : IDisposable
9 {
10 #region Static Fields and Constants
11  
12 private static readonly Mutex Mutex = new Mutex(true, Constants.AssemblyGuid);
13  
14 private static Form _form;
15  
16 #endregion
17  
18 #region Constructors, Destructors and Finalizers
19  
20 public void Dispose()
21 {
22 _form?.Dispose();
23 _form = null;
24 }
25  
26 #endregion
27  
28 #region Private Methods
29  
30 /// <summary>
31 /// The main entry point for the application.
32 /// </summary>
33 [STAThread]
34 private static void Main()
35 {
36 if (Mutex.WaitOne(TimeSpan.Zero, true))
37 {
38 Application.EnableVisualStyles();
39 Application.SetCompatibleTextRenderingDefault(false);
40 _form = new Form1();
41 Application.Run();
42 Mutex.ReleaseMutex();
43 return;
44 }
45  
46 // Foreground current other application window.
47 Natives.PostMessage(
48 (IntPtr) Natives.HWND_BROADCAST,
49 Natives.WM_SHOWME,
50 IntPtr.Zero,
51 IntPtr.Zero);
52 }
53  
54 #endregion
55 }
56 }