From c69881a0a22104986a7141f40f8c4dd0e2963f09 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Fri, 27 Dec 2024 00:47:57 -0600 Subject: [PATCH] UI: chore: remove direct static MainWindowViewModel reference --- src/Ryujinx/UI/Models/SaveModel.cs | 3 ++- src/Ryujinx/UI/ViewModels/SettingsViewModel.cs | 2 +- src/Ryujinx/UI/Windows/MainWindow.axaml.cs | 4 +--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Ryujinx/UI/Models/SaveModel.cs b/src/Ryujinx/UI/Models/SaveModel.cs index cfc397c6e..578538d21 100644 --- a/src/Ryujinx/UI/Models/SaveModel.cs +++ b/src/Ryujinx/UI/Models/SaveModel.cs @@ -1,3 +1,4 @@ +using Gommon; using LibHac.Fs; using LibHac.Ncm; using Ryujinx.Ava.UI.ViewModels; @@ -47,7 +48,7 @@ namespace Ryujinx.Ava.UI.Models TitleId = info.ProgramId; UserId = info.UserId; - var appData = MainWindow.MainWindowViewModel.Applications.FirstOrDefault(x => x.IdString.Equals(TitleIdString, StringComparison.OrdinalIgnoreCase)); + var appData = RyujinxApp.MainWindow.ViewModel.Applications.FirstOrDefault(x => x.IdString.EqualsIgnoreCase(TitleIdString)); InGameList = appData != null; diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index 7504147b2..9feaaba9b 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -750,7 +750,7 @@ namespace Ryujinx.Ava.UI.ViewModels config.ToFileFormat().SaveConfig(Program.ConfigurationPath); MainWindow.UpdateGraphicsConfig(); - MainWindow.MainWindowViewModel.VSyncModeSettingChanged(); + RyujinxApp.MainWindow.ViewModel.VSyncModeSettingChanged(); SaveSettingsEvent?.Invoke(); diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs index 660caa605..ca91b180f 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs @@ -39,8 +39,6 @@ namespace Ryujinx.Ava.UI.Windows { public partial class MainWindow : StyleableAppWindow { - internal static MainWindowViewModel MainWindowViewModel { get; private set; } - public MainWindowViewModel ViewModel { get; } internal readonly AvaHostUIHandler UiHandler; @@ -76,7 +74,7 @@ namespace Ryujinx.Ava.UI.Windows public MainWindow() { - DataContext = ViewModel = MainWindowViewModel = new MainWindowViewModel + DataContext = ViewModel = new MainWindowViewModel { Window = this };