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.
This commit is contained in:
_Neo_ 2025-11-17 13:43:23 +02:00
parent de11115971
commit 928a189d99

View file

@ -1,7 +1,7 @@
using Ryujinx.Ava.UI.Models; using Ryujinx.Ava.UI.Models;
using System; using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Collections.Specialized;
namespace Ryujinx.Ava.UI.ViewModels namespace Ryujinx.Ava.UI.ViewModels
{ {
@ -11,23 +11,32 @@ namespace Ryujinx.Ava.UI.ViewModels
{ {
Profiles = new ObservableCollection<BaseModel>(); Profiles = new ObservableCollection<BaseModel>();
LostProfiles = new ObservableCollection<UserProfile>(); LostProfiles = new ObservableCollection<UserProfile>();
LostProfiles.CollectionChanged += LostProfilesChanged;
} }
public ObservableCollection<BaseModel> Profiles { get; set; } public ObservableCollection<BaseModel> Profiles { get; }
public ObservableCollection<UserProfile> LostProfiles { get; set; } public ObservableCollection<UserProfile> LostProfiles { get; }
public bool IsEmpty => !LostProfiles.Any(); public bool IsEmpty => LostProfiles.Count == 0;
public void Dispose() public void Dispose()
{ {
GC.SuppressFinalize(this); LostProfiles.CollectionChanged -= LostProfilesChanged;
}
private void LostProfilesChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged(nameof(IsEmpty));
} }
public void UpdateLostProfiles(ObservableCollection<UserProfile> newProfiles) public void UpdateLostProfiles(ObservableCollection<UserProfile> newProfiles)
{ {
LostProfiles = newProfiles; LostProfiles.Clear();
OnPropertyChanged(nameof(LostProfiles));
foreach (var profile in newProfiles)
LostProfiles.Add(profile);
OnPropertyChanged(nameof(IsEmpty)); OnPropertyChanged(nameof(IsEmpty));
} }
} }