ryubing-ryujinx/src/Ryujinx/UI/ViewModels/UserProfileViewModel.cs
_Neo_ 928a189d99 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.
2025-11-17 13:43:23 +02:00

43 lines
1.2 KiB
C#

using Ryujinx.Ava.UI.Models;
using System;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
namespace Ryujinx.Ava.UI.ViewModels
{
public class UserProfileViewModel : BaseModel, IDisposable
{
public UserProfileViewModel()
{
Profiles = new ObservableCollection<BaseModel>();
LostProfiles = new ObservableCollection<UserProfile>();
LostProfiles.CollectionChanged += LostProfilesChanged;
}
public ObservableCollection<BaseModel> Profiles { get; }
public ObservableCollection<UserProfile> LostProfiles { get; }
public bool IsEmpty => LostProfiles.Count == 0;
public void Dispose()
{
LostProfiles.CollectionChanged -= LostProfilesChanged;
}
private void LostProfilesChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged(nameof(IsEmpty));
}
public void UpdateLostProfiles(ObservableCollection<UserProfile> newProfiles)
{
LostProfiles.Clear();
foreach (var profile in newProfiles)
LostProfiles.Add(profile);
OnPropertyChanged(nameof(IsEmpty));
}
}
}