mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-29 07:27:36 +08:00
完善挂时常
This commit is contained in:
+31
-9
@@ -28,11 +28,18 @@
|
||||
<Border DockPanel.Dock="Top" Grid.Row="0" Grid.RowSpan="2" Grid.Column="1" Classes="paper" Background="{DynamicResource ThemeBrushKey}" Padding="10" Margin="20 20 20 0">
|
||||
<DockPanel>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8" HorizontalAlignment="Left">
|
||||
|
||||
<controls:ProgressRing IsIndeterminate="True"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.GameList_RuningWait,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
HorizontalAlignment="Stretch"
|
||||
Height="30"
|
||||
Width="30"
|
||||
IsVisible="{Binding RunLoaingState}" />
|
||||
<ToggleButton Background="Transparent"
|
||||
Cursor="Hand"
|
||||
IsChecked="{Binding RunState,Mode=TwoWay}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.GameList_OnlyInstalled,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
Cursor="Hand"
|
||||
IsVisible="{Binding !RunLoaingState}"
|
||||
IsChecked="{Binding RunState,Mode=TwoWay}"
|
||||
Command="{ReflectionBinding RunOrStopAllButton_Click}"
|
||||
ToolTip.Tip="{Binding RunStateTxt}">
|
||||
<PathIcon Data="{StaticResource PlayCircleDrawing}" />
|
||||
</ToggleButton>
|
||||
|
||||
@@ -45,7 +52,7 @@
|
||||
</StackPanel>
|
||||
<Button Background="Transparent" Cursor="Hand" HorizontalAlignment="Right"
|
||||
Command="{ReflectionBinding DeleteAllButton_Click}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Refresh,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.GameList_RemoveBtn,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="16" Data="{StaticResource DeleteDrawing}" />
|
||||
</Button>
|
||||
</DockPanel>
|
||||
@@ -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}">
|
||||
<PathIcon Width="48" Height="48" Data="{DynamicResource PauseCircleDrawing}">
|
||||
@@ -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}">
|
||||
<PathIcon Width="48" Height="48" Data="{DynamicResource PlayCircleDrawing}">
|
||||
@@ -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}">
|
||||
<PathIcon Width="10" Data="{DynamicResource CloseDrawing}">
|
||||
@@ -134,7 +141,22 @@
|
||||
</Border>
|
||||
|
||||
<controls:ScrollingTextBlock Width="{ReflectionBinding #app.Width}" Text="{Binding DisplayName}" FontSize="12" FontWeight="Bold" Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
<controls:ScrollingTextBlock Width="{ReflectionBinding #app.Width}" Text="{Binding AppId}" FontSize="10" Foreground="{DynamicResource InactiveForegroundBrushKey}" />
|
||||
<Panel IsVisible="{Binding !Process,Converter={StaticResource IsNullConverter}}">
|
||||
<Ellipse Height="6" Width="6" Fill="#47A42B"></Ellipse>
|
||||
<TextBlock
|
||||
Text="{ReflectionBinding Path=Res.GameList_RunState,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
VerticalAlignment="Center"
|
||||
TextWrapping="WrapWithOverflow"
|
||||
FontSize="10" />
|
||||
</Panel>
|
||||
<Panel IsVisible="{Binding Process,Converter={StaticResource IsNullConverter}}">
|
||||
<Ellipse Height="6" Width="6" Fill="#FF4F58"> </Ellipse>
|
||||
<TextBlock
|
||||
Text="{ReflectionBinding Path=Res.GameList_StopState,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
VerticalAlignment="Center"
|
||||
TextWrapping="WrapWithOverflow"
|
||||
FontSize="10" />
|
||||
</Panel>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsRepeater.ItemTemplate>
|
||||
|
||||
@@ -872,6 +872,33 @@ namespace System.Application.UI.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 是否移除全部挂时常的游戏? 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string GameList_DeleteAll {
|
||||
get {
|
||||
return ResourceManager.GetString("GameList_DeleteAll", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 是否将该游戏挂时常? 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string GameList_DeleteItem {
|
||||
get {
|
||||
return ResourceManager.GetString("GameList_DeleteItem", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 移除成功 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string GameList_DeleteSuccess {
|
||||
get {
|
||||
return ResourceManager.GetString("GameList_DeleteSuccess", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 编辑游戏信息 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -953,6 +980,15 @@ namespace System.Application.UI.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 操作进行中请稍后再试 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string GameList_LoaingTips {
|
||||
get {
|
||||
return ResourceManager.GetString("GameList_LoaingTips", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 仅显示已安装的游戏 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -998,6 +1034,15 @@ namespace System.Application.UI.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 操作成功 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string GameList_OperationSuccess {
|
||||
get {
|
||||
return ResourceManager.GetString("GameList_OperationSuccess", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 开始游戏 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -1034,6 +1079,15 @@ namespace System.Application.UI.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 取消挂时常 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string GameList_RemoveItemBtn {
|
||||
get {
|
||||
return ResourceManager.GetString("GameList_RemoveItemBtn", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 调整封面大小 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -1070,6 +1124,15 @@ namespace System.Application.UI.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 运行中 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string GameList_RunState {
|
||||
get {
|
||||
return ResourceManager.GetString("GameList_RunState", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 设置自定义封面 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -1106,6 +1169,15 @@ namespace System.Application.UI.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 暂停中 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string GameList_StopState {
|
||||
get {
|
||||
return ResourceManager.GetString("GameList_StopState", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 不支持的操作 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -390,6 +390,15 @@
|
||||
<data name="GameList_AddAFKAppsSuccess" xml:space="preserve">
|
||||
<value>添加到挂时常列表成功</value>
|
||||
</data>
|
||||
<data name="GameList_DeleteAll" xml:space="preserve">
|
||||
<value>是否移除全部挂时常的游戏?</value>
|
||||
</data>
|
||||
<data name="GameList_DeleteItem" xml:space="preserve">
|
||||
<value>是否将该游戏挂时常?</value>
|
||||
</data>
|
||||
<data name="GameList_DeleteSuccess" xml:space="preserve">
|
||||
<value>移除成功</value>
|
||||
</data>
|
||||
<data name="GameList_EditAppInfo" xml:space="preserve">
|
||||
<value>编辑游戏信息</value>
|
||||
</data>
|
||||
@@ -417,6 +426,9 @@
|
||||
<data name="GameList_IsLoading" xml:space="preserve">
|
||||
<value>正在加载游戏列表...</value>
|
||||
</data>
|
||||
<data name="GameList_LoaingTips" xml:space="preserve">
|
||||
<value>操作进行中请稍后再试</value>
|
||||
</data>
|
||||
<data name="GameList_OnlyInstalled" xml:space="preserve">
|
||||
<value>仅显示已安装的游戏</value>
|
||||
</data>
|
||||
@@ -432,6 +444,9 @@
|
||||
<data name="GameList_OpenStoreUrl" xml:space="preserve">
|
||||
<value>打开商店页</value>
|
||||
</data>
|
||||
<data name="GameList_OperationSuccess" xml:space="preserve">
|
||||
<value>操作成功</value>
|
||||
</data>
|
||||
<data name="GameList_Play" xml:space="preserve">
|
||||
<value>开始游戏</value>
|
||||
</data>
|
||||
@@ -444,6 +459,9 @@
|
||||
<data name="GameList_RemoveBtn" xml:space="preserve">
|
||||
<value>移除全部</value>
|
||||
</data>
|
||||
<data name="GameList_RemoveItemBtn" xml:space="preserve">
|
||||
<value>取消挂时常</value>
|
||||
</data>
|
||||
<data name="GameList_ResizeAppLogo" xml:space="preserve">
|
||||
<value>调整封面大小</value>
|
||||
</data>
|
||||
@@ -456,6 +474,9 @@
|
||||
<data name="GameList_RuningWait" xml:space="preserve">
|
||||
<value>正在启动中...</value>
|
||||
</data>
|
||||
<data name="GameList_RunState" xml:space="preserve">
|
||||
<value>运行中</value>
|
||||
</data>
|
||||
<data name="GameList_SetCustomImage" xml:space="preserve">
|
||||
<value>设置自定义封面</value>
|
||||
</data>
|
||||
@@ -468,6 +489,9 @@
|
||||
<data name="GameList_StopItemBtn" xml:space="preserve">
|
||||
<value>暂停</value>
|
||||
</data>
|
||||
<data name="GameList_StopState" xml:space="preserve">
|
||||
<value>暂停中</value>
|
||||
</data>
|
||||
<data name="GameList_Unsupport" xml:space="preserve">
|
||||
<value>不支持的操作</value>
|
||||
</data>
|
||||
|
||||
+70
-12
@@ -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<SteamApp> _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<uint, string?>();
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user