Updating the game list when navigating folders is now on a separate thread like before. tweaked grid mode icon sizes

This commit is contained in:
Luke44565 2024-03-14 22:36:49 -04:00
parent 820d11fbca
commit 1ef15e5107
3 changed files with 34 additions and 30 deletions

View file

@ -45,6 +45,7 @@ namespace Ryujinx.UI.App.Common
private readonly VirtualFileSystem _virtualFileSystem;
private Language _desiredTitleLanguage;
private CancellationTokenSource _cancellationToken;
private bool _isLoading;
private static readonly ApplicationJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
private static readonly TitleUpdateMetadataJsonSerializerContext _titleSerializerContext = new(JsonHelper.GetDefaultSerializerOptions());
@ -89,6 +90,28 @@ namespace Ryujinx.UI.App.Common
}
public void LoadApplications(List<string> appDirs, Language desiredTitleLanguage)
{
if (_isLoading)
{
return;
}
_isLoading = true;
Thread applicationLibraryThread = new(() =>
{
LoadApplicationsReal(appDirs, desiredTitleLanguage);
_isLoading = false;
})
{
Name = "GUI.ApplicationLibraryThread",
IsBackground = true,
};
applicationLibraryThread.Start();
}
private void LoadApplicationsReal(List<string> appDirs, Language desiredTitleLanguage)
{
int numApplicationsFound = 0;
int numApplicationsLoaded = 0;

View file

@ -108,15 +108,15 @@
</Style>
<Style Selector="ui|SymbolIcon.gridNormal">
<Setter Property="FontSize"
Value="130" />
Value="120" />
</Style>
<Style Selector="ui|SymbolIcon.gridLarge">
<Setter Property="FontSize"
Value="140" />
Value="160" />
</Style>
<Style Selector="ui|SymbolIcon.gridHuge">
<Setter Property="FontSize"
Value="180" />
Value="200" />
</Style>
<Style Selector="#TitleBarHost &gt; Image">
<Setter Property="Margin"

View file

@ -35,8 +35,6 @@ namespace Ryujinx.Ava.UI.Windows
{
internal static MainWindowViewModel MainWindowViewModel { get; private set; }
private bool _isLoading;
private UserChannelPersistence _userChannelPersistence;
private static bool _deferLoad;
private static string _launchPath;
@ -534,39 +532,22 @@ namespace Ryujinx.Ava.UI.Windows
private void ReloadGameList()
{
if (_isLoading)
{
return;
}
_isLoading = true;
if (ViewModel.IsInFolder && !ConfigurationState.Instance.UI.UseSystemGameFolders)
{
ViewModel.PathHistory.Clear();
ViewModel.IsInFolder = false;
}
Thread applicationLibraryThread = new(() =>
if (ViewModel.IsInFolder)
{
if (ViewModel.IsInFolder)
{
List<string> SearchPaths = new();
SearchPaths.Add(ViewModel.PathHistory.Peek());
ApplicationLibrary.LoadApplications(SearchPaths, ConfigurationState.Instance.System.Language);
}
else
{
ApplicationLibrary.LoadApplications(ConfigurationState.Instance.UI.GameDirs, ConfigurationState.Instance.System.Language);
}
_isLoading = false;
})
List<string> SearchPaths = new();
SearchPaths.Add(ViewModel.PathHistory.Peek());
ApplicationLibrary.LoadApplications(SearchPaths, ConfigurationState.Instance.System.Language);
}
else
{
Name = "GUI.ApplicationLibraryThread",
IsBackground = true,
};
applicationLibraryThread.Start();
ApplicationLibrary.LoadApplications(ConfigurationState.Instance.UI.GameDirs, ConfigurationState.Instance.System.Language);
}
}
}
}