更新库存游戏列表加载方式

修复潜在的闪退问题
This commit is contained in:
rmbgame
2021-05-08 01:52:52 +08:00
parent 43b6ad6544
commit e513261507
15 changed files with 294 additions and 116 deletions
@@ -38,7 +38,7 @@ namespace System.Application.UI
static bool GetIsFirst()
{
var current = Process.GetCurrentProcess();
var query = from p in Process.GetProcesses()
var query = from p in Process.GetProcessesByName(current.ProcessName)
where p.Id != current.Id &&
p.ProcessName == current.ProcessName &&
(current.MainModule == null ||
@@ -83,11 +83,11 @@
<Setter Property="Height" Value="20"></Setter>
</Style>
</StackPanel.Styles>
<!--<Button Background="Transparent"
<Button Background="Transparent"
Cursor="Hand"
ToolTip.Tip="添加未拥有的游戏">
<PathIcon Data="{StaticResource AddDrawing}" />
</Button>-->
<PathIcon Data="{StaticResource AddDrawing}" />
</Button>
<Button Background="Transparent"
Command="{ReflectionBinding RefreshGamesList,Source={x:Static service:SteamConnectService.Current},Mode=OneWay}"
Cursor="Hand"
@@ -194,12 +194,12 @@
</TreeView.ItemTemplate>
</TreeView>-->
<Panel>
<StackPanel IsVisible="{Binding IsSteamAppsEmpty}"
<StackPanel IsVisible="{ReflectionBinding Source={x:Static service:SteamConnectService.Current},Path=IsLoadingGameList,Mode=OneWay}"
HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="10">
<controls:ProgressRing IsIndeterminate="True"
Width="150" Height="150">
Width="100" Height="100">
</controls:ProgressRing>
<TextBlock Text="正在加载游戏列表..."></TextBlock>
<TextBlock Text="{ReflectionBinding Path=Res.GameList_IsLoading,Mode=OneWay,Source={x:Static resx:R.Current}}"></TextBlock>
</StackPanel>
<TextBlock IsVisible="{Binding IsSteamAppsEmpty}"
@@ -209,12 +209,12 @@
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Padding="0 0 0 10">
<ItemsRepeater Items="{Binding SteamApps}">
<ItemsRepeater.Layout>
<UniformGridLayout ItemsJustification="SpaceEvenly" MinRowSpacing="10" MinColumnSpacing="10" MaximumRowsOrColumns="10" ItemsStretch="Fill" />
<UniformGridLayout ItemsJustification="SpaceEvenly" MinRowSpacing="10" MinColumnSpacing="20" MaximumRowsOrColumns="10" ItemsStretch="Fill" />
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<StackPanel Spacing="8">
<Border DockPanel.Dock="Top" Classes="paper">
<Border DockPanel.Dock="Top" Classes="paper" Width="{ReflectionBinding Value,Source={x:Static ms:UISettings.AppGridSize},Mode=OneWay}">
<Border.ContextMenu>
<ContextMenu>
<MenuItem
@@ -259,6 +259,8 @@
Header="{ReflectionBinding Path=Res.GameList_SetCustomImage,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding #u.DataContext.DeleteUserButton_Click}"
CommandParameter="{Binding}" />-->
<MenuItem Header="-"></MenuItem>
<MenuItem
Header="{ReflectionBinding Path=Res.GameList_OpenStoreUrl,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding #u.DataContext.OpenAppStoreUrl}"
@@ -273,7 +275,7 @@
CommandParameter="{Binding}" />
</ContextMenu>
</Border.ContextMenu>
<Panel x:Name="app" Width="{ReflectionBinding Value,Source={x:Static ms:UISettings.AppGridSize},Mode=OneWay}">
<Panel x:Name="app" Width="{ReflectionBinding $parent.Width}">
<!--<i:Interaction.Behaviors>
<ia:EventTriggerBehavior EventName="Tapped" SourceObject="{ReflectionBinding #app}">
<ia:InvokeCommandAction Command="{ReflectionBinding #u.DataContext.AppClick}" CommandParameter="{Binding}"/>
@@ -28,87 +28,116 @@
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<Panel>
<Border x:Name="panel" Classes="paper" Width="250" Height="250" Background="{DynamicResource ThemeBrushKey}">
<i:Interaction.Behaviors>
<ia:EventTriggerBehavior EventName="PointerEnter" SourceObject="{ReflectionBinding #panel}">
<ia:ChangePropertyAction TargetObject="{ReflectionBinding #delete_btn}" PropertyName="IsVisible" Value="True"/>
</ia:EventTriggerBehavior>
<ia:EventTriggerBehavior EventName="PointerLeave" SourceObject="{ReflectionBinding #panel}">
<ia:ChangePropertyAction TargetObject="{ReflectionBinding #delete_btn}" PropertyName="IsVisible" Value="False"/>
</ia:EventTriggerBehavior>
</i:Interaction.Behaviors>
<Grid RowDefinitions="30,165,Auto">
<DockPanel VerticalAlignment="Center">
<TextBox VerticalAlignment="Center"
VerticalContentAlignment="Center"
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_AuthName,Mode=OneWay,Source={x:Static resx:R.Current}}"
Text="{Binding Name,Mode=TwoWay}"
Classes="readonlybox"
DockPanel.Dock="Left"
Padding="10,5"
FontSize="16"
Foreground="{DynamicResource HighlightForegroundBrushKey}">
<TextBox.InnerRightContent>
<PathIcon Data="{StaticResource EditDrawing}"
Width="10" Height="10"
Opacity="0.8"
VerticalAlignment="Center" HorizontalAlignment="Left"
Margin="0">
</PathIcon>
</TextBox.InnerRightContent>
</TextBox>
<Button DockPanel.Dock="Right" x:Name="delete_btn" Classes="flatbutton" IsVisible="False" Background="{DynamicResource ThemeBrushKey}" HorizontalAlignment="Right" Cursor="Hand" ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_DeleteUser,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding #u.DataContext.DeleteAuth}" CommandParameter="{Binding}">
<PathIcon Data="{DynamicResource CloseDrawing}" Width="12"></PathIcon>
<Border x:Name="panel" Classes="paper" Width="250" Height="250" Background="{DynamicResource ThemeBrushKey}">
<Border.ContextMenu>
<ContextMenu>
<MenuItem
Header="复制令牌"
Command="{ReflectionBinding #u.DataContext.InstallOrStartApp}"
CommandParameter="{Binding}">
<MenuItem.Icon>
<PathIcon Data="{StaticResource CopyDrawing}" Width="14"></PathIcon>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="-"></MenuItem>
<MenuItem
Header="上移"
Command="{ReflectionBinding #u.DataContext.InstallOrStartApp}"
CommandParameter="{Binding}">
<MenuItem.Icon>
<PathIcon Data="{StaticResource DownloadDrawing}" Width="14"></PathIcon>
</MenuItem.Icon>
</MenuItem>
<MenuItem
Header="下移"
Command="{ReflectionBinding #u.DataContext.InstallOrStartApp}"
CommandParameter="{Binding}">
<MenuItem.Icon>
<PathIcon Data="{StaticResource DownloadDrawing}" Width="14"></PathIcon>
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</Border.ContextMenu>
<i:Interaction.Behaviors>
<ia:EventTriggerBehavior EventName="PointerEnter" SourceObject="{ReflectionBinding #panel}">
<ia:ChangePropertyAction TargetObject="{ReflectionBinding #delete_btn}" PropertyName="IsVisible" Value="True"/>
</ia:EventTriggerBehavior>
<ia:EventTriggerBehavior EventName="PointerLeave" SourceObject="{ReflectionBinding #panel}">
<ia:ChangePropertyAction TargetObject="{ReflectionBinding #delete_btn}" PropertyName="IsVisible" Value="False"/>
</ia:EventTriggerBehavior>
</i:Interaction.Behaviors>
<Grid RowDefinitions="30,165,Auto">
<DockPanel VerticalAlignment="Center">
<TextBox VerticalAlignment="Center"
VerticalContentAlignment="Center"
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_AuthName,Mode=OneWay,Source={x:Static resx:R.Current}}"
Text="{Binding Name,Mode=TwoWay}"
Classes="readonlybox"
DockPanel.Dock="Left"
Padding="10,5"
FontSize="16"
Foreground="{DynamicResource HighlightForegroundBrushKey}">
<TextBox.InnerRightContent>
<PathIcon Data="{StaticResource EditDrawing}"
Width="10" Height="10"
Opacity="0.8"
VerticalAlignment="Center" HorizontalAlignment="Left"
Margin="0">
</PathIcon>
</TextBox.InnerRightContent>
</TextBox>
<Button DockPanel.Dock="Right" x:Name="delete_btn" Classes="flatbutton" IsVisible="False" Background="{DynamicResource ThemeBrushKey}" HorizontalAlignment="Right" Cursor="Hand" ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_DeleteUser,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding #u.DataContext.DeleteAuth}" CommandParameter="{Binding}">
<PathIcon Data="{DynamicResource CloseDrawing}" Width="12"></PathIcon>
</Button>
</DockPanel>
<TextBlock Grid.Row="1" Text="------" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="64" IsVisible="{Binding !IsShowCode}" Foreground="{DynamicResource HighlightForegroundBrushKey}"></TextBlock>
<TextBlock Grid.Row="1" Text="{Binding CurrentCode}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="54" IsVisible="{Binding IsShowCode}" Foreground="{DynamicResource HighlightForegroundBrushKey}">
</TextBlock>
<DockPanel Grid.Row="2" HorizontalAlignment="Stretch" VerticalAlignment="Center">
<Panel DockPanel.Dock="Top">
<Separator Height="13" IsVisible="{Binding !IsShowCode}"></Separator>
<ProgressBar Value="{Binding CodeCountdown,Mode=TwoWay}" IsVisible="{Binding IsShowCode}" Margin="0 10 0 4"/>
<Separator Classes="Separator" Margin="0 14 0 4"/>
</Panel>
<!--<controls:ScrollingTextBlock HorizontalAlignment="Center" Width="{Binding #panel.Width}" Text="{Binding}" FontSize="14" Foreground="{DynamicResource HighlightForegroundBrushKey}" ></controls:ScrollingTextBlock>-->
<StackPanel Orientation="Horizontal" Spacing="5">
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.ShowAuthCode}" CommandParameter="{Binding}"
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_ShowAuthCode,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<PathIcon Data="{DynamicResource SearchDrawing}" Width="20"></PathIcon>
</Button>
</DockPanel>
<TextBlock Grid.Row="1" Text="------" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="64" IsVisible="{Binding !IsShowCode}" Foreground="{DynamicResource HighlightForegroundBrushKey}"></TextBlock>
<TextBlock Grid.Row="1" Text="{Binding CurrentCode}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="54" IsVisible="{Binding IsShowCode}" Foreground="{DynamicResource HighlightForegroundBrushKey}">
</TextBlock>
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.ShowSteamAuthTrade}" CommandParameter="{Binding}"
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_AuthTrade,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<PathIcon Data="{DynamicResource TradeDrawing}" Width="20"></PathIcon>
</Button>
<DockPanel Grid.Row="2" HorizontalAlignment="Stretch" VerticalAlignment="Center">
<Panel DockPanel.Dock="Top">
<Separator Height="13" IsVisible="{Binding !IsShowCode}"></Separator>
<ProgressBar Value="{Binding CodeCountdown,Mode=TwoWay}" IsVisible="{Binding IsShowCode}" Margin="0 10 0 4"/>
<Separator Classes="Separator" Margin="0 14 0 4"/>
</Panel>
<!--<controls:ScrollingTextBlock HorizontalAlignment="Center" Width="{Binding #panel.Width}" Text="{Binding}" FontSize="14" Foreground="{DynamicResource HighlightForegroundBrushKey}" ></controls:ScrollingTextBlock>-->
<StackPanel Orientation="Horizontal" Spacing="5">
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.ShowAuthCode}" CommandParameter="{Binding}"
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_ShowAuthCode,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<PathIcon Data="{DynamicResource SearchDrawing}" Width="20"></PathIcon>
</Button>
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.ShowSteamAuthTrade}" CommandParameter="{Binding}"
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_AuthTrade,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<PathIcon Data="{DynamicResource TradeDrawing}" Width="20"></PathIcon>
</Button>
<!--<Button Cursor="Hand" Classes="flatbutton"
<!--<Button Cursor="Hand" Classes="flatbutton"
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_CloudSync,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<PathIcon Data="{DynamicResource CloudDrawing}" Width="20"></PathIcon>
</Button>-->
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.ShowSteamAuthData}" CommandParameter="{Binding}"
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_ShowAuthInfo,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<PathIcon Data="{DynamicResource SlideSearchDrawing}" Width="20"></PathIcon>
</Button>
</StackPanel>
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.CopyCodeCilp}" CommandParameter="{Binding}" HorizontalAlignment="Right"
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_Copy,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<PathIcon Data="{DynamicResource CopyDrawing}" Width="20"></PathIcon>
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.ShowSteamAuthData}" CommandParameter="{Binding}"
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_ShowAuthInfo,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<PathIcon Data="{DynamicResource SlideSearchDrawing}" Width="20"></PathIcon>
</Button>
</DockPanel>
</Grid>
</Border>
</Panel>
</StackPanel>
<Button Cursor="Hand" Classes="flatbutton" Command="{ReflectionBinding #u.DataContext.CopyCodeCilp}" CommandParameter="{Binding}" HorizontalAlignment="Right"
ToolTip.Tip="{ReflectionBinding Path=Res.LocalAuth_Copy,Mode=OneWay,Source={x:Static resx:R.Current}}" >
<PathIcon Data="{DynamicResource CopyDrawing}" Width="20"></PathIcon>
</Button>
</DockPanel>
</Grid>
</Border>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
@@ -43,6 +43,7 @@
Header="{ReflectionBinding Path=Res.UserChange_OfflineBtn,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding #u.DataContext.OfflineModeButton_Click}"
CommandParameter="{Binding}" />
<MenuItem Header="-"></MenuItem>
<MenuItem
Header="{ReflectionBinding Path=Res.UserChange_DeleteUser,Mode=OneWay,Source={x:Static resx:R.Current}}"
Command="{ReflectionBinding #u.DataContext.DeleteUserButton_Click}"
@@ -0,0 +1,24 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
Width="600" Height="450"
x:Class="System.Application.UI.Views.Windows.PasswordWindow"
xmlns:resx="clr-namespace:System.Application.UI.Resx;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:vm="clr-namespace:System.Application.UI.ViewModels;assembly=System.Application.SteamTools.Client.Desktop"
xmlns:controls="clr-namespace:System.Application.UI.Views.Controls"
xmlns:ms="clr-namespace:System.Application.Models.Settings;assembly=System.Application.SteamTools.Client.Desktop"
FontFamily="{Binding Source={x:Static ms:UISettings.FontName},Path=Value, Mode=OneWay,Converter={StaticResource NameToFontFamilyConverter}}"
Background="Transparent"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
ExtendClientAreaTitleBarHeightHint="30"
Title="{Binding Title}"
x:DataType="vm:ShowAuthWindowViewModel"
x:CompileBindings="True">
<Panel HorizontalAlignment="Stretch">
<controls:TitleBar></controls:TitleBar>
</Panel>
</Window>
@@ -0,0 +1,22 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace System.Application.UI.Views.Windows
{
public class PasswordWindow : FluentWindow
{
public PasswordWindow() : base()
{
InitializeComponent();
#if DEBUG
this.AttachDevTools();
#endif
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
@@ -70,6 +70,9 @@
<Compile Update="Application\UI\Views\Windows\LocalAuthPage\EncryptionAuthWindow.axaml.cs">
<DependentUpon>EncryptionAuthWindow.axaml</DependentUpon>
</Compile>
<Compile Update="Application\UI\Views\Windows\LocalAuthPage\PasswordWindow.axaml.cs">
<DependentUpon>PasswordWindow.axaml</DependentUpon>
</Compile>
<Compile Update="Application\UI\Views\Windows\LocalAuthPage\ExportAuthWindow.axaml.cs">
<DependentUpon>ExportAuthWindow.axaml</DependentUpon>
</Compile>
@@ -280,39 +280,47 @@ namespace System.Application.Services.Implementation
List<SteamApp> GetAppInfos_()
{
var apps = new List<SteamApp>();
if (string.IsNullOrEmpty(AppInfoPath) && !File.Exists(AppInfoPath))
return apps;
using (BinaryReader binaryReader = new(File.OpenRead(AppInfoPath)))
try
{
uint num = binaryReader.ReadUInt32();
if (num != MagicNumber)
{
Log.Error(nameof(GetAppInfos), string.Format("\"{0}\" magic code is not supported: 0x{1:X8}", Path.GetFileName(AppInfoPath), num));
if (string.IsNullOrEmpty(AppInfoPath) && !File.Exists(AppInfoPath))
return apps;
}
SteamApp? app = new();
unknownValueAtStart = binaryReader.ReadUInt32();
while ((app = SteamApp.FromReader(binaryReader)) != null)
using (BinaryReader binaryReader = new(File.OpenRead(AppInfoPath)))
{
if (app.AppId > 0)
uint num = binaryReader.ReadUInt32();
if (num != MagicNumber)
{
if (GameLibrarySettings.DefaultIgnoreList.Contains(app.AppId))
continue;
if (app.ParentId > 0)
Log.Error(nameof(GetAppInfos), string.Format("\"{0}\" magic code is not supported: 0x{1:X8}", Path.GetFileName(AppInfoPath), num));
return apps;
}
SteamApp? app = new();
unknownValueAtStart = binaryReader.ReadUInt32();
while ((app = SteamApp.FromReader(binaryReader)) != null)
{
if (app.AppId > 0)
{
var parentApp = apps.FirstOrDefault(f => f.AppId == app.ParentId);
if (parentApp != null)
parentApp.ChildApp.Add(app.AppId);
//continue;
if (GameLibrarySettings.DefaultIgnoreList.Contains(app.AppId))
continue;
if (app.ParentId > 0)
{
var parentApp = apps.FirstOrDefault(f => f.AppId == app.ParentId);
if (parentApp != null)
parentApp.ChildApp.Add(app.AppId);
//continue;
}
apps.Add(app);
//app.Modified += (s, e) =>
//{
//};
}
apps.Add(app);
//app.Modified += (s, e) =>
//{
//};
}
}
return apps;
}
catch (Exception ex)
{
Log.Error(nameof(SteamServiceImpl), ex, nameof(GetAppInfos));
return apps;
}
return apps;
}
}
@@ -387,6 +387,7 @@ namespace System.Application.Services
Toast.Show(msg);
}
}
public async Task AddNewScript(FileInfo fileInfo, ScriptDTO? info, ScriptDTO? oldInfo = null)
{
IsLoading = true;
@@ -410,6 +411,7 @@ namespace System.Application.Services
IsLoading = false;
Toast.Show(item.msg);
}
public async void RefreshScript()
{
var scriptList = await DI.Get<IScriptManagerService>().GetAllScript();
@@ -428,6 +430,7 @@ namespace System.Application.Services
CheckUpdate();
}
public async void DownloadScript(ScriptDTO model)
{
model.IsLoading = true;
@@ -466,6 +469,7 @@ namespace System.Application.Services
Toast.Show(AppResources.Download_ScriptError);
model.IsLoading = false;
}
public async void CheckUpdate()
{
var items = Current.ProxyScripts.Items.Where(x => x.Id.HasValue).Select(x => x.Id!.Value).ToList();
@@ -110,6 +110,19 @@ namespace System.Application.Services
}
#endregion
private bool _IsLoadingGameList = true;
public bool IsLoadingGameList
{
get => _IsLoadingGameList;
set
{
if (_IsLoadingGameList != value)
{
_IsLoadingGameList = value;
this.RaisePropertyChanged();
}
}
}
public void Initialize()
{
@@ -117,7 +130,6 @@ namespace System.Application.Services
SteamTool.StartSteam(SteamSettings.SteamStratParameter.Value);
Task.Run(InitializeGameList).ForgetAndDispose();
var t = new Task(async () =>
{
Thread.CurrentThread.IsBackground = true;
@@ -144,7 +156,14 @@ namespace System.Application.Services
IsSteamChinaLauncher = ApiService.IsSteamChinaLauncher();
#region 初始化需要steam启动才能使用的功能
InitializeGameList();
if (SteamApps.Items.Any())
{
LoadGames(SteamApps.Items);
}
else
{
LoadGames(await ISteamService.Instance.GetAppInfos());
}
//尝试十次无法获取到就不再尝试
for (var i = 0; i < 10; i++)
@@ -201,8 +220,10 @@ namespace System.Application.Services
public async void InitializeGameList()
{
IsLoadingGameList = true;
LoadGames(await ISteamService.Instance.GetAppInfos());
//UpdateGamesImage();
IsLoadingGameList = false;
}
public void UpdateGamesImage()
@@ -246,6 +267,7 @@ namespace System.Application.Services
{
if (ApiService.Initialize())
{
SteamApps.Clear();
while (true)
{
InitializeGameList();
+27
View File
@@ -854,6 +854,15 @@ namespace System.Application.UI.Resx {
}
}
/// <summary>
/// 查找类似 管理隐藏游戏列表 的本地化字符串。
/// </summary>
public static string GameList_HideGameManger {
get {
return ResourceManager.GetString("GameList_HideGameManger", resourceCulture);
}
}
/// <summary>
/// 查找类似 隐藏此游戏 的本地化字符串。
/// </summary>
@@ -863,6 +872,15 @@ namespace System.Application.UI.Resx {
}
}
/// <summary>
/// 查找类似 管理游戏时长挂机列表 的本地化字符串。
/// </summary>
public static string GameList_IdleGamesManger {
get {
return ResourceManager.GetString("GameList_IdleGamesManger", resourceCulture);
}
}
/// <summary>
/// 查找类似 安装 的本地化字符串。
/// </summary>
@@ -881,6 +899,15 @@ namespace System.Application.UI.Resx {
}
}
/// <summary>
/// 查找类似 正在加载游戏列表... 的本地化字符串。
/// </summary>
public static string GameList_IsLoading {
get {
return ResourceManager.GetString("GameList_IsLoading", resourceCulture);
}
}
/// <summary>
/// 查找类似 仅显示已安装的游戏 的本地化字符串。
/// </summary>
@@ -384,15 +384,24 @@
<data name="GameList_EditAppInfo" xml:space="preserve">
<value>编辑游戏信息</value>
</data>
<data name="GameList_HideGameManger" xml:space="preserve">
<value>管理隐藏游戏列表</value>
</data>
<data name="GameList_HideTheGame" xml:space="preserve">
<value>隐藏此游戏</value>
</data>
<data name="GameList_IdleGamesManger" xml:space="preserve">
<value>管理游戏时长挂机列表</value>
</data>
<data name="GameList_Install" xml:space="preserve">
<value>安装</value>
</data>
<data name="GameList_IsEmpty" xml:space="preserve">
<value>没有获取到任何游戏数据</value>
</data>
<data name="GameList_IsLoading" xml:space="preserve">
<value>正在加载游戏列表...</value>
</data>
<data name="GameList_OnlyInstalled" xml:space="preserve">
<value>仅显示已安装的游戏</value>
</data>
@@ -14,8 +14,6 @@ namespace System.Application.UI.ViewModels
{
public class CommunityProxyPageViewModel : TabItemViewModel
{
readonly IHttpProxyService httpProxyService = DI.Get<IHttpProxyService>();
public override string Name
{
get => AppResources.CommunityFix;
@@ -105,12 +103,12 @@ namespace System.Application.UI.ViewModels
public void SetupCertificate_OnClick()
{
httpProxyService.SetupCertificate();
DI.Get<IHttpProxyService>().SetupCertificate();
}
public void DeleteCertificate_OnClick()
{
httpProxyService.DeleteCertificate();
DI.Get<IHttpProxyService>().DeleteCertificate();
}
public void EditHostsFile_OnClick()
@@ -111,6 +111,13 @@ namespace System.Application.UI.ViewModels
this.RaisePropertyChanged(nameof(IsSteamAppsEmpty));
this.CalcTypeCount();
});
MenuItems = new ObservableCollection<MenuItemViewModel>()
{
new MenuItemViewModel(nameof(AppResources.GameList_HideGameManger)),
new MenuItemViewModel (nameof(AppResources.GameList_IdleGamesManger)),
};
}
internal override void Activation()
@@ -158,8 +165,7 @@ namespace System.Application.UI.ViewModels
set => this.RaiseAndSetIfChanged(ref _SearchText, value);
}
public bool IsSteamAppsLoading => IsSteamAppsEmpty;
public bool IsSteamAppsEmpty => !SteamApps.Any_Nullable();
public bool IsSteamAppsEmpty => !SteamApps.Any_Nullable() && !SteamConnectService.Current.IsLoadingGameList;
private ObservableCollection<EnumModel<SteamAppType>> _AppTypeFiltres = new();
public ObservableCollection<EnumModel<SteamAppType>> AppTypeFiltres
@@ -168,7 +174,6 @@ namespace System.Application.UI.ViewModels
set => this.RaiseAndSetIfChanged(ref _AppTypeFiltres, value);
}
private IReadOnlyCollection<EnumModel<SteamAppType>> _EnableAppTypeFiltres = new List<EnumModel<SteamAppType>>();
public IReadOnlyCollection<EnumModel<SteamAppType>> EnableAppTypeFiltres
{
@@ -0,0 +1,24 @@
using Newtonsoft.Json.Linq;
using ReactiveUI;
using System.Application.Models;
using System.Application.UI.Resx;
using System.Properties;
namespace System.Application.UI.ViewModels
{
public class PasswordWindowViewModel : WindowViewModel
{
public PasswordWindowViewModel() : base()
{
Title = ThisAssembly.AssemblyTrademark + " | " + AppResources.LocalAuth_AuthData;
}
private string? _Password;
public string? Password
{
get => _Password;
set => this.RaiseAndSetIfChanged(ref _Password, value);
}
}
}