From aa625e5f441a45f5504492794ec978e66040e436 Mon Sep 17 00:00:00 2001 From: Mossimo Date: Tue, 18 May 2021 09:45:09 +0800 Subject: [PATCH] fix tips --- .../GameListPage/IdleAppWindowViewModel.cs | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/ST.Client.Desktop/UI/ViewModels/Windows/GameListPage/IdleAppWindowViewModel.cs b/src/ST.Client.Desktop/UI/ViewModels/Windows/GameListPage/IdleAppWindowViewModel.cs index cb70a90a2..4b97a3357 100644 --- a/src/ST.Client.Desktop/UI/ViewModels/Windows/GameListPage/IdleAppWindowViewModel.cs +++ b/src/ST.Client.Desktop/UI/ViewModels/Windows/GameListPage/IdleAppWindowViewModel.cs @@ -134,9 +134,14 @@ namespace System.Application.UI.ViewModels } else { - if (runState.Process == null) + if (runState.Process == null || !runState.Process.HasExited) + { runState.Process = Process.Start(AppHelper.ProgramPath, "-clt -silence app -id " + runState.AppId.ToString(CultureInfo.InvariantCulture)); - item.Process = runState.Process; + } + else + { + item.Process = runState.Process; + } } } } @@ -177,7 +182,6 @@ namespace System.Application.UI.ViewModels else { RunOrStop(runInfoState); - app.Process = runInfoState.Process; } RunState = IdleGameList.Count(x => x.Process != null) > 0; Toast.Show(AppResources.GameList_OperationSuccess); @@ -208,18 +212,29 @@ namespace System.Application.UI.ViewModels if (runState != null && runState.Process != null) { RunState = true; - appInfo.Process = runState.Process; - appInfo.Process.Exited += (object? item, EventArgs e) => + if (runState.Process.HasExited) { - SteamConnectService.Current.RuningSteamApps.Remove(runState); - }; - appInfo.Process.EnableRaisingEvents = true; + appInfo.Process = runState.Process; + appInfo.Process.Exited += (object? item, EventArgs e) => + { + SteamConnectService.Current.RuningSteamApps.Remove(runState); + }; + appInfo.Process.EnableRaisingEvents = true; + } + else + appInfo.Process = null; + } + else + { + appInfo.Process = null; } - appInfo.Process = null; list.Add(appInfo); } else { + var runState = SteamConnectService.Current.RuningSteamApps.FirstOrDefault(x => x.AppId == item.Key); + runState?.Process?.Kill(); + list.Add(new SteamApp { AppId = item.Key,