From e43d899e1ddb9bc919fc107329c10db36d1712c2 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Tue, 31 Dec 2024 00:19:23 -0600 Subject: [PATCH] misc: Use a few static helpers for Avalonia objects --- .../UI/ViewModels/DownloadableContentManagerViewModel.cs | 5 +---- src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs | 4 +--- src/Ryujinx/UI/ViewModels/ModManagerViewModel.cs | 5 +---- src/Ryujinx/UI/ViewModels/TitleUpdateViewModel.cs | 5 +---- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/Ryujinx/UI/ViewModels/DownloadableContentManagerViewModel.cs b/src/Ryujinx/UI/ViewModels/DownloadableContentManagerViewModel.cs index 4e9660a65..acc26decb 100644 --- a/src/Ryujinx/UI/ViewModels/DownloadableContentManagerViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/DownloadableContentManagerViewModel.cs @@ -93,10 +93,7 @@ namespace Ryujinx.Ava.UI.ViewModels _applicationData = applicationData; - if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) - { - _storageProvider = desktop.MainWindow.StorageProvider; - } + _storageProvider = RyujinxApp.MainWindow.StorageProvider; LoadDownloadableContents(); } diff --git a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs index 74b8681d5..16f8e46fa 100644 --- a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs @@ -245,9 +245,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input { if (Program.PreviewerDetached) { - _mainWindow = - (MainWindow)((IClassicDesktopStyleApplicationLifetime)Application.Current - .ApplicationLifetime).MainWindow; + _mainWindow = RyujinxApp.MainWindow; AvaloniaKeyboardDriver = new AvaloniaKeyboardDriver(owner); diff --git a/src/Ryujinx/UI/ViewModels/ModManagerViewModel.cs b/src/Ryujinx/UI/ViewModels/ModManagerViewModel.cs index df2ef266e..9c26376ce 100644 --- a/src/Ryujinx/UI/ViewModels/ModManagerViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/ModManagerViewModel.cs @@ -86,10 +86,7 @@ namespace Ryujinx.Ava.UI.ViewModels _modJsonPath = Path.Combine(AppDataManager.GamesDirPath, applicationId.ToString("x16"), "mods.json"); - if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) - { - _storageProvider = desktop.MainWindow.StorageProvider; - } + _storageProvider = RyujinxApp.MainWindow.StorageProvider; LoadMods(applicationId); } diff --git a/src/Ryujinx/UI/ViewModels/TitleUpdateViewModel.cs b/src/Ryujinx/UI/ViewModels/TitleUpdateViewModel.cs index a179218af..0748efeb4 100644 --- a/src/Ryujinx/UI/ViewModels/TitleUpdateViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/TitleUpdateViewModel.cs @@ -76,10 +76,7 @@ namespace Ryujinx.Ava.UI.ViewModels ApplicationData = applicationData; - if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) - { - StorageProvider = desktop.MainWindow.StorageProvider; - } + StorageProvider = RyujinxApp.MainWindow.StorageProvider; LoadUpdates(); }