Skip to content

Commit

Permalink
misc: Add CommunityToolkit.Mvvm for observable property generation; a…
Browse files Browse the repository at this point in the history
…pply it to MainWindowViewModel for now.
  • Loading branch information
GreemDev committed Dec 31, 2024
1 parent 19d2883 commit 61ae427
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 561 deletions.
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<PackageVersion Include="Projektanker.Icons.Avalonia.FontAwesome" Version="9.4.0"/>
<PackageVersion Include="Projektanker.Icons.Avalonia.MaterialDesign" Version="9.4.0"/>
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0"/>
<PackageVersion Include="Concentus" Version="2.2.0" />
<PackageVersion Include="DiscordRichPresence" Version="1.2.1.24" />
<PackageVersion Include="DynamicData" Version="9.0.4" />
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx/AppHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public void UpdateVSyncMode(object sender, ReactiveEventArgs<VSyncMode> e)

_renderer.Window?.ChangeVSyncMode(e.NewValue);

_viewModel.ShowCustomVSyncIntervalPicker = (e.NewValue == VSyncMode.Custom);
_viewModel.UpdateVSyncIntervalPicker();
}

public void VSyncModeToggle()
Expand Down
3 changes: 2 additions & 1 deletion src/Ryujinx/Ryujinx.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<PackageReference Include="Avalonia.Svg" />
<PackageReference Include="Avalonia.Svg.Skia" />
<PackageReference Include="CommandLineParser" />
<PackageReference Include="CommunityToolkit.Mvvm" />
<PackageReference Include="DiscordRichPresence" />
<PackageReference Include="DynamicData" />
<PackageReference Include="FluentAvaloniaUI" />
Expand Down Expand Up @@ -162,4 +163,4 @@
<ItemGroup>
<AdditionalFiles Include="Assets\locales.json" />
</ItemGroup>
</Project>
</Project>
12 changes: 2 additions & 10 deletions src/Ryujinx/UI/ViewModels/BaseModel.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace Ryujinx.Ava.UI.ViewModels
{
public class BaseModel : INotifyPropertyChanged
public class BaseModel : ObservableObject
{
public event PropertyChangedEventHandler PropertyChanged;

protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

protected void OnPropertiesChanged(string firstPropertyName, params ReadOnlySpan<string> propertyNames)
{
OnPropertyChanged(firstPropertyName);
Expand Down
Loading

0 comments on commit 61ae427

Please sign in to comment.