private async Task GetProcess() { Process[] processes = Process.GetProcesses(); Process? proc = null; // Search for ffxiv process if (this.EnableProcess) { foreach (Process process in processes) { if (process.ProcessName.ToLower().Contains("ffxiv_dx11")) { proc = process; } } } // if no process, open the process selector GUI if (proc == null) { await Dispatch.MainThread(); if (App.Current == null) { return; } App.Current.MainWindow.Topmost = false; proc = ProcessSelector.FindProcess(); if (SettingsService.Exists) { App.Current.MainWindow.Topmost = SettingsService.Current.AlwaysOnTop; } await Dispatch.NonUiThread(); } // if still no process, shutdown. if (proc == null) { await Dispatch.MainThread(); App.Current.MainWindow.Close(); App.Current.Shutdown(); return; } this.OpenProcess(proc); await AddressService.Scan(); IsProcessAlive = true; }
private async Task GetProcess() { Process?proc = null; await Dispatch.MainThread(); if (App.Current == null) { return; } App.Current.MainWindow.Topmost = false; proc = ProcessSelector.FindProcess(); if (SettingsService.Exists) { App.Current.MainWindow.Topmost = SettingsService.Current.AlwaysOnTop; } await Dispatch.NonUiThread(); // if still no process, shutdown. if (proc == null) { await Dispatch.MainThread(); App.Current.MainWindow.Close(); App.Current.Shutdown(); return; } this.OpenProcess(proc); await AddressService.Scan(); IsProcessAlive = true; }