Spring – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 using System;
2 using System.Runtime.InteropServices;
3 using System.Threading;
4 using System.Windows.Forms;
5 using Spring.Main;
6  
7 namespace Spring
8 {
9 internal static class Program
10 {
11 #region Static Fields and Constants
12  
13 private static readonly Mutex Mutex = new Mutex(true, Constants.AssemblyGuid);
14  
15 #endregion
16  
17 #region Private Methods
18  
19 /// <summary>
20 /// The main entry point for the application.
21 /// </summary>
22 [STAThread]
23 private static void Main()
24 {
25 if (Mutex.WaitOne(TimeSpan.Zero, true))
26 {
27 Application.EnableVisualStyles();
28 Application.SetCompatibleTextRenderingDefault(false);
29 Application.Run(new MainForm());
30  
31 return;
32 }
33  
34 // Foreground current other application window.
35 Natives.PostMessage(
36 (IntPtr) Natives.HWndBroadcast,
37 Natives.WmShowMe,
38 IntPtr.Zero,
39 IntPtr.Zero);
40 }
41  
42 #endregion
43  
44 #region Nested Types
45  
46 internal class Natives
47 {
48 #region Static Fields and Constants
49  
50 public const int HWndBroadcast = 0xffff;
51  
52 public static readonly int WmShowMe = RegisterWindowMessage("WM_SHOWME");
53  
54 #endregion
55  
56 #region Public Methods
57  
58 [DllImport("user32.dll", EntryPoint = "RegisterWindowMessageW", SetLastError = true)]
59 public static extern int RegisterWindowMessage(string lpString);
60  
61 [DllImport("user32")]
62 public static extern bool PostMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
63  
64 #endregion
65 }
66  
67 #endregion
68 }
69 }