Fix Error

This commit is contained in:
Mossimo
2021-05-23 16:52:53 +08:00
parent 17a9ec53cc
commit e50945332f
6 changed files with 72 additions and 8 deletions
@@ -47,7 +47,10 @@
</MenuItem.Header>
</MenuItem>
</Menu>
<TextBlock IsVisible="{CompiledBinding IsHideGameListEmpty}"
Text="{ReflectionBinding Path=Res.GameList_AddHideAppEmpty,Mode=OneWay,Source={x:Static resx:R.Current}}"
TextWrapping="WrapWithOverflow"
VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"
Padding="{StaticResource TitleBarAfterMargin}">
@@ -34,7 +34,7 @@
Height="30"
Width="30"
IsVisible="{Binding RunLoaingState}" />
<Button
<Button
Background="Transparent"
Cursor="Hand"
IsVisible="{Binding RunState}"
@@ -43,7 +43,7 @@
<PathIcon Width="16" Height="16" Data="{DynamicResource PauseCircleDrawing}">
</PathIcon>
</Button>
<Button
<Button
Background="Transparent"
Cursor="Hand"
IsVisible="{Binding !RunState}"
@@ -71,10 +71,15 @@
</Button>
</DockPanel>
</Border>
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"
Padding="20">
<StackPanel>
<TextBlock IsVisible="{CompiledBinding IsIdleAppEmpty}"
Text="{ReflectionBinding Path=Res.GameList_AddIdeaAppEmpty,Mode=OneWay,Source={x:Static resx:R.Current}}"
TextWrapping="WrapWithOverflow"
VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
<ItemsRepeater Items="{Binding IdleGameList}">
<ItemsRepeater.Layout>
<UniformGridLayout ItemsJustification="SpaceEvenly" MinRowSpacing="10" MinColumnSpacing="20" MaximumRowsOrColumns="10" ItemsStretch="Fill" />
+18
View File
@@ -872,6 +872,24 @@ namespace System.Application.UI.Resx {
}
}
/// <summary>
/// 查找类似 隐藏游戏列表为空,请从游戏列表右键添加需要隐藏的游戏。 的本地化字符串。
/// </summary>
public static string GameList_AddHideAppEmpty {
get {
return ResourceManager.GetString("GameList_AddHideAppEmpty", resourceCulture);
}
}
/// <summary>
/// 查找类似 未添加挂时常的游戏,请冲游戏列表邮件添加。 的本地化字符串。
/// </summary>
public static string GameList_AddIdeaAppEmpty {
get {
return ResourceManager.GetString("GameList_AddIdeaAppEmpty", resourceCulture);
}
}
/// <summary>
/// 查找类似 程序启动时自动挂时常 的本地化字符串。
/// </summary>
@@ -390,6 +390,12 @@
<data name="GameList_AddAFKAppsSuccess" xml:space="preserve">
<value>添加到挂时常列表成功</value>
</data>
<data name="GameList_AddHideAppEmpty" xml:space="preserve">
<value>隐藏游戏列表为空,请从游戏列表右键添加需要隐藏的游戏。</value>
</data>
<data name="GameList_AddIdeaAppEmpty" xml:space="preserve">
<value>未添加挂时常的游戏,请冲游戏列表邮件添加。</value>
</data>
<data name="GameList_AutoAFK" xml:space="preserve">
<value>程序启动时自动挂时常</value>
</data>
@@ -22,6 +22,12 @@ namespace System.Application.UI.ViewModels
Refresh_Click();
}
public bool _IsHideGameListEmpty;
public bool IsHideGameListEmpty
{
get => _IsHideGameListEmpty;
set => this.RaiseAndSetIfChanged(ref _IsHideGameListEmpty, value);
}
public ObservableCollection<KeyValuePair<uint, string>> _HideGameList = new();
public ObservableCollection<KeyValuePair<uint, string>> HideGameList
@@ -40,6 +46,11 @@ namespace System.Application.UI.ViewModels
public void Refresh_Click()
{
HideGameList = new ObservableCollection<KeyValuePair<uint, string>>(GameLibrarySettings.HideGameList.Value!);
if (HideGameList.Count == 0)
IsHideGameListEmpty = true;
else
IsHideGameListEmpty = false;
}
public void ChangeCheck(KeyValuePair<uint, string> keyValue)
@@ -49,6 +49,13 @@ namespace System.Application.UI.ViewModels
this.RaiseAndSetIfChanged(ref _RunState, value);
}
}
public bool _IsIdleAppEmpty;
public bool IsIdleAppEmpty
{
get => _IsIdleAppEmpty;
set => this.RaiseAndSetIfChanged(ref _IsIdleAppEmpty, value);
}
public ObservableCollection<SteamApp> _IdleGameList = new();
public ObservableCollection<SteamApp> IdleGameList
@@ -64,6 +71,7 @@ namespace System.Application.UI.ViewModels
{
if (GameLibrarySettings.AFKAppList.Value != null)
{
try {
foreach (var item in GameLibrarySettings.AFKAppList.Value)
{
var runState = SteamConnectService.Current.RuningSteamApps.FirstOrDefault(x => x.AppId == item.Key);
@@ -73,11 +81,19 @@ namespace System.Application.UI.ViewModels
SteamConnectService.Current.RuningSteamApps.Remove(runState);
}
}
IdleGameList.Clear();
GameLibrarySettings.AFKAppList.Value.Clear();
GameLibrarySettings.AFKAppList.RaiseValueChanged();
RunState = false;
Toast.Show(AppResources.GameList_DeleteSuccess);
}
catch{
}
MainThreadDesktop.BeginInvokeOnMainThread(() =>
{
IdleGameList.Clear();
RunState = false;
IsIdleAppEmpty = true;
GameLibrarySettings.AFKAppList.Value.Clear();
GameLibrarySettings.AFKAppList.RaiseValueChanged();
Toast.Show(AppResources.GameList_DeleteSuccess);
});
}
}
});
@@ -244,6 +260,11 @@ namespace System.Application.UI.ViewModels
}
}
IdleGameList = list;
if (IdleGameList.Count == 0)
IsIdleAppEmpty = true;
else
IsIdleAppEmpty = false;
Toast.Show(AppResources.GameList_OperationSuccess);
}