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