Hide back button when folders are disabled, reload game list when the folder setting is changed

This commit is contained in:
Luke44565 2024-03-18 17:42:32 -04:00
parent 1ef15e5107
commit 7761382740
4 changed files with 32 additions and 3 deletions

View file

@ -86,6 +86,7 @@ namespace Ryujinx.Ava.UI.ViewModels
private string _lastScannedAmiiboId; private string _lastScannedAmiiboId;
private bool _statusBarVisible; private bool _statusBarVisible;
private bool _isInFolder; private bool _isInFolder;
private bool _foldersEnabled;
private ReadOnlyObservableCollection<ApplicationData> _appsObservableList; private ReadOnlyObservableCollection<ApplicationData> _appsObservableList;
private string _showUiKey = "F4"; private string _showUiKey = "F4";
@ -123,6 +124,7 @@ namespace Ryujinx.Ava.UI.ViewModels
_rendererWaitEvent = new AutoResetEvent(false); _rendererWaitEvent = new AutoResetEvent(false);
_pathHistory = new Stack<string>(); _pathHistory = new Stack<string>();
FoldersEnabled = ConfigurationState.Instance.UI.UseSystemGameFolders;
if (Program.PreviewerDetached) if (Program.PreviewerDetached)
{ {
@ -683,6 +685,16 @@ namespace Ryujinx.Ava.UI.ViewModels
OnPropertyChanged(); OnPropertyChanged();
} }
} }
public bool FoldersEnabled
{
get => _foldersEnabled;
set
{
_foldersEnabled = value;
OnPropertyChanged();
}
}
internal void Sort(bool isAscending) internal void Sort(bool isAscending)
{ {

View file

@ -116,6 +116,7 @@ namespace Ryujinx.Ava.UI.ViewModels
public bool IsHypervisorAvailable => OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64; public bool IsHypervisorAvailable => OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64;
public bool FolderModeChanged;
public bool DirectoryChanged public bool DirectoryChanged
{ {
get => _directoryChanged; get => _directoryChanged;
@ -491,7 +492,6 @@ namespace Ryujinx.Ava.UI.ViewModels
config.EnableDiscordIntegration.Value = EnableDiscordIntegration; config.EnableDiscordIntegration.Value = EnableDiscordIntegration;
config.CheckUpdatesOnStart.Value = CheckUpdatesOnStart; config.CheckUpdatesOnStart.Value = CheckUpdatesOnStart;
config.ShowConfirmExit.Value = ShowConfirmExit; config.ShowConfirmExit.Value = ShowConfirmExit;
config.UI.UseSystemGameFolders.Value = UseSystemGameFolders;
config.HideCursor.Value = (HideCursorMode)HideCursor; config.HideCursor.Value = (HideCursorMode)HideCursor;
if (_directoryChanged) if (_directoryChanged)
@ -500,6 +500,12 @@ namespace Ryujinx.Ava.UI.ViewModels
config.UI.GameDirs.Value = gameDirs; config.UI.GameDirs.Value = gameDirs;
} }
if (UseSystemGameFolders != config.UI.UseSystemGameFolders.Value)
{
FolderModeChanged = true;
}
config.UI.UseSystemGameFolders.Value = UseSystemGameFolders;
config.UI.BaseStyle.Value = BaseStyleIndex == 0 ? "Light" : "Dark"; config.UI.BaseStyle.Value = BaseStyleIndex == 0 ? "Light" : "Dark";
// Input // Input
@ -590,6 +596,7 @@ namespace Ryujinx.Ava.UI.ViewModels
SaveSettingsEvent?.Invoke(); SaveSettingsEvent?.Invoke();
_directoryChanged = false; _directoryChanged = false;
FolderModeChanged = false;
} }
private static void RevertIfNotSaved() private static void RevertIfNotSaved()

View file

@ -24,6 +24,7 @@
Margin="5,2,0,2" Margin="5,2,0,2"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
Command="{Binding NavigateBack}" Command="{Binding NavigateBack}"
IsVisible="{Binding FoldersEnabled}"
IsEnabled="{Binding IsInFolder}"> IsEnabled="{Binding IsInFolder}">
<ui:FontIcon <ui:FontIcon
Margin="0" Margin="0"

View file

@ -39,9 +39,18 @@ namespace Ryujinx.Ava.UI.Windows
{ {
InputPage.ControllerSettings?.SaveCurrentProfile(); InputPage.ControllerSettings?.SaveCurrentProfile();
if (Owner is MainWindow window && ViewModel.DirectoryChanged) if (Owner is MainWindow window)
{ {
window.LoadApplications(); if (ViewModel.DirectoryChanged)
{
window.LoadApplications();
}
if (ViewModel.FolderModeChanged)
{
window.LoadApplications();
window.ViewModel.FoldersEnabled = ViewModel.UseSystemGameFolders;
}
} }
} }