public static void ByProcAndName(string process, string title) { if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX) { BringToForeGroundLinux.BringToFront(title); return; } setForegroundByHwnd(findWindow(process, title)); }
private static void setForegroundByHwnd(IntPtr hWnd) { if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX) { BringToForeGroundLinux.BringToFront(hWnd); } else { BringToForeGroundWindows.BringToFront(hWnd); } }
private static void setForegroundByPid(int pid) { var proc = Process.GetProcessById(pid); if (proc != null) { if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX) { BringToForeGroundLinux.BringToFront(pid); } else { setForegroundByHwnd(proc.MainWindowHandle); } } }