diff --git a/CollapseLauncher/MainPage.xaml.cs b/CollapseLauncher/MainPage.xaml.cs index 25ff45a67..e37db74c3 100644 --- a/CollapseLauncher/MainPage.xaml.cs +++ b/CollapseLauncher/MainPage.xaml.cs @@ -43,6 +43,8 @@ public MainPage() LauncherUpdateWatcher.StartCheckUpdate(); + Task.Run(() => CheckRunningGameInstance()); + InitializeStartup().GetAwaiter(); } catch (Exception ex) @@ -52,6 +54,16 @@ public MainPage() } } + private async void CheckRunningGameInstance() + { + while (true && !App.IsAppKilled) + { + string execName = Path.GetFileNameWithoutExtension(CurrentRegion.GameExecutableName); + App.IsGameRunning = Process.GetProcessesByName(execName).Length != 0 && !App.IsAppKilled; + await Task.Delay(3000); + } + } + private void NotificationInvoker_EventInvoker(object sender, NotificationInvokerProp e) { SpawnNotificationPush(e.Notification.Title, e.Notification.Message, e.Notification.Severity,