From 928a189d997e76c30a05b0f6ca81eb688445ddb8 Mon Sep 17 00:00:00 2001 From: _Neo_ Date: Mon, 17 Nov 2025 13:43:23 +0200 Subject: [PATCH] Fix "No Profiles To Recover" not updating in certain instances "No Profiles To Recover" text did not show up after saving the recovered profile, as the user is still on the "Profile Recovery" window. This now updates this. --- .../UI/ViewModels/UserProfileViewModel.cs | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/Ryujinx/UI/ViewModels/UserProfileViewModel.cs b/src/Ryujinx/UI/ViewModels/UserProfileViewModel.cs index 7f4d18ba7..792f9ea0a 100644 --- a/src/Ryujinx/UI/ViewModels/UserProfileViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/UserProfileViewModel.cs @@ -1,7 +1,7 @@ using Ryujinx.Ava.UI.Models; using System; using System.Collections.ObjectModel; -using System.Linq; +using System.Collections.Specialized; namespace Ryujinx.Ava.UI.ViewModels { @@ -11,23 +11,32 @@ namespace Ryujinx.Ava.UI.ViewModels { Profiles = new ObservableCollection(); LostProfiles = new ObservableCollection(); + LostProfiles.CollectionChanged += LostProfilesChanged; } - public ObservableCollection Profiles { get; set; } + public ObservableCollection Profiles { get; } - public ObservableCollection LostProfiles { get; set; } + public ObservableCollection LostProfiles { get; } - public bool IsEmpty => !LostProfiles.Any(); + public bool IsEmpty => LostProfiles.Count == 0; public void Dispose() { - GC.SuppressFinalize(this); + LostProfiles.CollectionChanged -= LostProfilesChanged; + } + + private void LostProfilesChanged(object sender, NotifyCollectionChangedEventArgs e) + { + OnPropertyChanged(nameof(IsEmpty)); } public void UpdateLostProfiles(ObservableCollection newProfiles) { - LostProfiles = newProfiles; - OnPropertyChanged(nameof(LostProfiles)); + LostProfiles.Clear(); + + foreach (var profile in newProfiles) + LostProfiles.Add(profile); + OnPropertyChanged(nameof(IsEmpty)); } }