diff --git a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/GameListPage/IdleAppWindow.axaml b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/GameListPage/IdleAppWindow.axaml
index 8895f8d7c..84bdb80dc 100644
--- a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/GameListPage/IdleAppWindow.axaml
+++ b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Windows/GameListPage/IdleAppWindow.axaml
@@ -28,11 +28,18 @@
-
+
+ Cursor="Hand"
+ IsVisible="{Binding !RunLoaingState}"
+ IsChecked="{Binding RunState,Mode=TwoWay}"
+ Command="{ReflectionBinding RunOrStopAllButton_Click}"
+ ToolTip.Tip="{Binding RunStateTxt}">
@@ -45,7 +52,7 @@
@@ -99,7 +106,7 @@
VerticalAlignment="Center"
HorizontalAlignment="Center"
IsVisible="{Binding !Process,Converter={StaticResource IsNullConverter}}"
- ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_DeleteUser,Mode=OneWay,Source={x:Static resx:R.Current}}"
+ ToolTip.Tip="{ReflectionBinding Path=Res.GameList_StopItemBtn,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding #u.DataContext.RunStopBtn_Click}"
CommandParameter="{Binding}">
@@ -111,7 +118,7 @@
VerticalAlignment="Center"
HorizontalAlignment="Center"
IsVisible="{Binding Process,Converter={StaticResource IsNullConverter}}"
- ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_DeleteUser,Mode=OneWay,Source={x:Static resx:R.Current}}"
+ ToolTip.Tip="{ReflectionBinding Path=Res.GameList_RuningItemBtn,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding #u.DataContext.RunStopBtn_Click}"
CommandParameter="{Binding}">
@@ -122,7 +129,7 @@
Cursor="Hand"
HorizontalAlignment="Right"
Margin="0,0,0,150"
- ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_DeleteUser,Mode=OneWay,Source={x:Static resx:R.Current}}"
+ ToolTip.Tip="{ReflectionBinding Path=Res.GameList_RemoveItemBtn,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding #u.DataContext.DeleteButton_Click}"
CommandParameter="{Binding}">
@@ -134,7 +141,22 @@
-
+
+
+
+
+
+
+
+
diff --git a/src/ST.Client.Desktop/UI/Resx/AppResources.Designer.cs b/src/ST.Client.Desktop/UI/Resx/AppResources.Designer.cs
index b8a3dbb91..74a1cfe5b 100644
--- a/src/ST.Client.Desktop/UI/Resx/AppResources.Designer.cs
+++ b/src/ST.Client.Desktop/UI/Resx/AppResources.Designer.cs
@@ -872,6 +872,33 @@ namespace System.Application.UI.Resx {
}
}
+ ///
+ /// 查找类似 是否移除全部挂时常的游戏? 的本地化字符串。
+ ///
+ public static string GameList_DeleteAll {
+ get {
+ return ResourceManager.GetString("GameList_DeleteAll", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 是否将该游戏挂时常? 的本地化字符串。
+ ///
+ public static string GameList_DeleteItem {
+ get {
+ return ResourceManager.GetString("GameList_DeleteItem", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 移除成功 的本地化字符串。
+ ///
+ public static string GameList_DeleteSuccess {
+ get {
+ return ResourceManager.GetString("GameList_DeleteSuccess", resourceCulture);
+ }
+ }
+
///
/// 查找类似 编辑游戏信息 的本地化字符串。
///
@@ -953,6 +980,15 @@ namespace System.Application.UI.Resx {
}
}
+ ///
+ /// 查找类似 操作进行中请稍后再试 的本地化字符串。
+ ///
+ public static string GameList_LoaingTips {
+ get {
+ return ResourceManager.GetString("GameList_LoaingTips", resourceCulture);
+ }
+ }
+
///
/// 查找类似 仅显示已安装的游戏 的本地化字符串。
///
@@ -998,6 +1034,15 @@ namespace System.Application.UI.Resx {
}
}
+ ///
+ /// 查找类似 操作成功 的本地化字符串。
+ ///
+ public static string GameList_OperationSuccess {
+ get {
+ return ResourceManager.GetString("GameList_OperationSuccess", resourceCulture);
+ }
+ }
+
///
/// 查找类似 开始游戏 的本地化字符串。
///
@@ -1034,6 +1079,15 @@ namespace System.Application.UI.Resx {
}
}
+ ///
+ /// 查找类似 取消挂时常 的本地化字符串。
+ ///
+ public static string GameList_RemoveItemBtn {
+ get {
+ return ResourceManager.GetString("GameList_RemoveItemBtn", resourceCulture);
+ }
+ }
+
///
/// 查找类似 调整封面大小 的本地化字符串。
///
@@ -1070,6 +1124,15 @@ namespace System.Application.UI.Resx {
}
}
+ ///
+ /// 查找类似 运行中 的本地化字符串。
+ ///
+ public static string GameList_RunState {
+ get {
+ return ResourceManager.GetString("GameList_RunState", resourceCulture);
+ }
+ }
+
///
/// 查找类似 设置自定义封面 的本地化字符串。
///
@@ -1106,6 +1169,15 @@ namespace System.Application.UI.Resx {
}
}
+ ///
+ /// 查找类似 暂停中 的本地化字符串。
+ ///
+ public static string GameList_StopState {
+ get {
+ return ResourceManager.GetString("GameList_StopState", resourceCulture);
+ }
+ }
+
///
/// 查找类似 不支持的操作 的本地化字符串。
///
diff --git a/src/ST.Client.Desktop/UI/Resx/AppResources.resx b/src/ST.Client.Desktop/UI/Resx/AppResources.resx
index 27104d40f..9b3cdfc45 100644
--- a/src/ST.Client.Desktop/UI/Resx/AppResources.resx
+++ b/src/ST.Client.Desktop/UI/Resx/AppResources.resx
@@ -390,6 +390,15 @@
添加到挂时常列表成功
+
+ 是否移除全部挂时常的游戏?
+
+
+ 是否将该游戏挂时常?
+
+
+ 移除成功
+
编辑游戏信息
@@ -417,6 +426,9 @@
正在加载游戏列表...
+
+ 操作进行中请稍后再试
+
仅显示已安装的游戏
@@ -432,6 +444,9 @@
打开商店页
+
+ 操作成功
+
开始游戏
@@ -444,6 +459,9 @@
移除全部
+
+ 取消挂时常
+
调整封面大小
@@ -456,6 +474,9 @@
正在启动中...
+
+ 运行中
+
设置自定义封面
@@ -468,6 +489,9 @@
暂停
+
+ 暂停中
+
不支持的操作
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 48df865e8..d11dc9626 100644
--- a/src/ST.Client.Desktop/UI/ViewModels/Windows/GameListPage/IdleAppWindowViewModel.cs
+++ b/src/ST.Client.Desktop/UI/ViewModels/Windows/GameListPage/IdleAppWindowViewModel.cs
@@ -27,12 +27,27 @@ namespace System.Application.UI.ViewModels
// .AutoRefresh(x => x.Process));
Refresh_Click();
}
-
+ private string _RunStateTxt;
+ public string RunStateTxt
+ {
+ get => _RunStateTxt;
+ set => this.RaiseAndSetIfChanged(ref _RunStateTxt, value);
+ }
+ private bool _RunLoaingState;
+ public bool RunLoaingState
+ {
+ get => _RunLoaingState;
+ set => this.RaiseAndSetIfChanged(ref _RunLoaingState, value);
+ }
private bool _RunState;
public bool RunState
{
get => _RunState;
- set => this.RaiseAndSetIfChanged(ref _RunState, value);
+ set
+ {
+ RunStateTxt = value ? AppResources.GameList_StopBtn : AppResources.GameList_RuningBtn;
+ this.RaiseAndSetIfChanged(ref _RunState, value);
+ }
}
public ObservableCollection _IdleGameList = new();
@@ -43,7 +58,7 @@ namespace System.Application.UI.ViewModels
}
public void DeleteAllButton_Click()
{
- var result = MessageBoxCompat.ShowAsync(@AppResources.ScriptShop_NoLogin, ThisAssembly.AssemblyTrademark, MessageBoxButtonCompat.OKCancel).ContinueWith((s) =>
+ var result = MessageBoxCompat.ShowAsync(@AppResources.GameList_DeleteAll, ThisAssembly.AssemblyTrademark, MessageBoxButtonCompat.OKCancel).ContinueWith((s) =>
{
if (s.Result == MessageBoxResultCompat.OK)
{
@@ -59,16 +74,17 @@ namespace System.Application.UI.ViewModels
}
}
IdleGameList.Clear();
- GameLibrarySettings.AFKAppList.Value = new Dictionary();
+ GameLibrarySettings.AFKAppList.Value.Clear();
GameLibrarySettings.AFKAppList.RaiseValueChanged();
-
+ RunState = false;
+ Toast.Show(AppResources.GameList_DeleteSuccess);
}
}
});
}
public void DeleteButton_Click(SteamApp app)
{
- var result = MessageBoxCompat.ShowAsync(@AppResources.ScriptShop_NoLogin, ThisAssembly.AssemblyTrademark, MessageBoxButtonCompat.OKCancel).ContinueWith((s) =>
+ var result = MessageBoxCompat.ShowAsync(@AppResources.GameList_DeleteItem, ThisAssembly.AssemblyTrademark, MessageBoxButtonCompat.OKCancel).ContinueWith((s) =>
{
if (s.Result == MessageBoxResultCompat.OK)
{
@@ -84,9 +100,10 @@ namespace System.Application.UI.ViewModels
SteamConnectService.Current.RuningSteamApps.Remove(runState);
}
IdleGameList.Remove(app);
+ RunState = IdleGameList.Count(x => x.Process != null) > 0;
GameLibrarySettings.AFKAppList.Value.Remove(app.AppId);
GameLibrarySettings.AFKAppList.RaiseValueChanged();
-
+ Toast.Show(AppResources.GameList_DeleteSuccess);
}
}
@@ -97,10 +114,48 @@ namespace System.Application.UI.ViewModels
public void RunOrStopAllButton_Click()
{
- if (RunState) {
-
- } else {
-
+ if (!RunLoaingState)
+ {
+ RunLoaingState = true;
+ if (RunState)
+ {
+
+ foreach (var item in IdleGameList)
+ {
+ var runState = SteamConnectService.Current.RuningSteamApps.FirstOrDefault(x => x.AppId == item.AppId);
+ if (runState == null)
+ {
+
+ item.Process = Process.Start(AppHelper.ProgramPath, "-clt app -silence -id " + item.AppId.ToString(CultureInfo.InvariantCulture));
+ SteamConnectService.Current.RuningSteamApps.Add(item);
+ }
+ else
+ {
+ if (runState.Process == null)
+ runState.Process = Process.Start(AppHelper.ProgramPath, "-clt app -silence -id " + item.AppId.ToString(CultureInfo.InvariantCulture));
+ item.Process = runState.Process;
+ }
+ }
+ }
+ else
+ {
+ foreach (var item in IdleGameList)
+ {
+ var runState = SteamConnectService.Current.RuningSteamApps.FirstOrDefault(x => x.AppId == item.AppId);
+ if (runState != null)
+ {
+ runState.Process?.Kill();
+ SteamConnectService.Current.RuningSteamApps.Remove(runState);
+ item.Process = null;
+ }
+ }
+ }
+ RunLoaingState = false;
+ Toast.Show(AppResources.GameList_OperationSuccess);
+ }
+ else
+ {
+ Toast.Show(AppResources.GameList_LoaingTips);
}
}
public void RunStopBtn_Click(SteamApp app)
@@ -116,6 +171,8 @@ namespace System.Application.UI.ViewModels
RunOrStop(runInfoState);
app.Process = runInfoState.Process;
}
+ RunState = IdleGameList.Count(x => x.Process != null) > 0;
+ Toast.Show(AppResources.GameList_OperationSuccess);
}
public void RunOrStop(SteamApp app)
{
@@ -142,7 +199,7 @@ namespace System.Application.UI.ViewModels
var runState = SteamConnectService.Current.RuningSteamApps.FirstOrDefault(x => x.AppId == item.Key);
if (runState != null && runState.Process != null)
{
-
+ RunState = true;
appInfo.Process = runState.Process;
appInfo.Process.Exited += (object? item, EventArgs e) =>
{
@@ -154,6 +211,7 @@ namespace System.Application.UI.ViewModels
}
}
IdleGameList = list;
+ Toast.Show(AppResources.GameList_OperationSuccess);
}
}