|
@@ -33,54 +33,54 @@ namespace BLETool
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- private static Process RunningInstance()
|
|
+ private static Process RunningInstance()
|
|
- {
|
|
|
|
- Process current = Process.GetCurrentProcess();
|
|
|
|
-
|
|
|
|
- Process[] processes = Process.GetProcessesByName(current.ProcessName);
|
|
|
|
- foreach (Process process in processes)
|
|
|
|
{
|
|
{
|
|
-
|
|
+ Process current = Process.GetCurrentProcess();
|
|
- if (process.Id != current.Id)
|
|
+
|
|
|
|
+ Process[] processes = Process.GetProcessesByName(current.ProcessName);
|
|
|
|
+ foreach (Process process in processes)
|
|
{
|
|
{
|
|
- if (Assembly.GetExecutingAssembly().Location.Replace("/", "\\") == current.MainModule.FileName)
|
|
+
|
|
|
|
+ if (process.Id != current.Id)
|
|
{
|
|
{
|
|
- return process;
|
|
+ if (Assembly.GetExecutingAssembly().Location.Replace("/", "\\") == current.MainModule.FileName)
|
|
|
|
+ {
|
|
|
|
+ return process;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public static void HandleRunningInstance(Process instance)
|
|
|
|
+ {
|
|
|
|
+ ShowWindowAsync(instance.MainWindowHandle, WS_SHOWNORMAL);
|
|
|
|
+ SetForegroundWindow(instance.MainWindowHandle);
|
|
}
|
|
}
|
|
-
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- public static void HandleRunningInstance(Process instance)
|
|
|
|
- {
|
|
|
|
- ShowWindowAsync(instance.MainWindowHandle, WS_SHOWNORMAL);
|
|
|
|
- SetForegroundWindow(instance.MainWindowHandle);
|
|
|
|
- }
|
|
|
|
|
|
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- [DllImport("User32.dll")]
|
|
+ [DllImport("User32.dll")]
|
|
- private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);
|
|
+ private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- [DllImport("User32.dll")]
|
|
+ [DllImport("User32.dll")]
|
|
- private static extern bool SetForegroundWindow(IntPtr hWnd);
|
|
+ private static extern bool SetForegroundWindow(IntPtr hWnd);
|
|
- private const int WS_SHOWNORMAL = 1;
|
|
+ private const int WS_SHOWNORMAL = 1;
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|