Winify – Diff between revs 8 and 19

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