Winify – Diff between revs 28 and 30

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