diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2017-01-16 13:24:26 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2017-01-16 13:24:26 +0300 |
commit | 2e07a79d4ddd78bc0ac06bf87c9e86979cce414b (patch) | |
tree | 0bef97808cf9c020e33e655ae6d6e2bddc4407a6 /Program.cs | |
parent | 10de3c40654d71a58095ff900567a8e592e2a738 (diff) |
Code cleanup
Diffstat (limited to 'Program.cs')
-rw-r--r-- | Program.cs | 92 |
1 files changed, 45 insertions, 47 deletions
@@ -1,47 +1,45 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Runtime.InteropServices; -using System.Threading; -using System.Windows.Forms; - -namespace com.clusterrr.hakchi_gui -{ - static class Program - { - [DllImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - static extern bool SetForegroundWindow(IntPtr hWnd); - - /// <summary> - /// The main entry point for the application. - /// </summary> - [STAThread] - static void Main() - { - bool createdNew = true; - using (Mutex mutex = new Mutex(true, "hakchi2", out createdNew)) - { - if (createdNew) - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MainForm()); - } - else - { - Process current = Process.GetCurrentProcess(); - foreach (Process process in Process.GetProcessesByName(current.ProcessName)) - { - if (process.Id != current.Id) - { - SetForegroundWindow(process.MainWindowHandle); - break; - } - } - } - } - } - } -} +using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using System.Threading;
+using System.Windows.Forms;
+
+namespace com.clusterrr.hakchi_gui
+{
+ static class Program
+ {
+ [DllImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ static extern bool SetForegroundWindow(IntPtr hWnd);
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ bool createdNew = true;
+ using (Mutex mutex = new Mutex(true, "hakchi2", out createdNew))
+ {
+ if (createdNew)
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new MainForm());
+ }
+ else
+ {
+ Process current = Process.GetCurrentProcess();
+ foreach (Process process in Process.GetProcessesByName(current.ProcessName))
+ {
+ if (process.Id != current.Id)
+ {
+ SetForegroundWindow(process.MainWindowHandle);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+}
|