mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-27 08:10:22 -06:00
misc: More Mvvm usage instead of writing out the observable properties
This commit is contained in:
@ -1,8 +1,7 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Collections;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Platform.Storage;
|
||||
using Avalonia.Threading;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using DynamicData;
|
||||
using Gommon;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
@ -18,13 +17,13 @@ using System.Linq;
|
||||
|
||||
namespace Ryujinx.Ava.UI.ViewModels
|
||||
{
|
||||
public class ModManagerViewModel : BaseModel
|
||||
public partial class ModManagerViewModel : BaseModel
|
||||
{
|
||||
private readonly string _modJsonPath;
|
||||
|
||||
private AvaloniaList<ModModel> _mods = new();
|
||||
private AvaloniaList<ModModel> _views = new();
|
||||
private AvaloniaList<ModModel> _selectedMods = new();
|
||||
[ObservableProperty] private AvaloniaList<ModModel> _views = new();
|
||||
[ObservableProperty] private AvaloniaList<ModModel> _selectedMods = new();
|
||||
|
||||
private string _search;
|
||||
private readonly ulong _applicationId;
|
||||
@ -44,26 +43,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public AvaloniaList<ModModel> Views
|
||||
{
|
||||
get => _views;
|
||||
set
|
||||
{
|
||||
_views = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public AvaloniaList<ModModel> SelectedMods
|
||||
{
|
||||
get => _selectedMods;
|
||||
set
|
||||
{
|
||||
_selectedMods = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Search
|
||||
{
|
||||
get => _search;
|
||||
@ -143,8 +122,10 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
.Filter(Filter)
|
||||
.Bind(out var view).AsObservableList();
|
||||
|
||||
#pragma warning disable MVVMTK0034 // Event to update is fired below
|
||||
_views.Clear();
|
||||
_views.AddRange(view);
|
||||
#pragma warning restore MVVMTK0034
|
||||
|
||||
SelectedMods = new(Views.Where(x => x.Enabled));
|
||||
|
||||
|
Reference in New Issue
Block a user