From 50cd3add3f512693fd6d574929664d3a56032295 Mon Sep 17 00:00:00 2001 From: Jimmy Reichley Date: Sun, 18 Aug 2024 16:55:33 -0400 Subject: [PATCH] Stub out bulk dlc menu item --- .../UI/ViewModels/MainWindowViewModel.cs | 28 +++++++++++++++++++ .../UI/Views/Main/MainMenuBarView.axaml | 5 ++++ 2 files changed, 33 insertions(+) diff --git a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs index a619781558..45a8383bcb 100644 --- a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs @@ -8,6 +8,7 @@ using Avalonia.Threading; using DynamicData; using DynamicData.Alias; using DynamicData.Binding; +using FluentAvalonia.UI.Controls; using LibHac.Common; using Ryujinx.Ava.Common; using Ryujinx.Ava.Common.Locale; @@ -39,6 +40,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.IO; +using System.Linq; using System.Threading; using System.Threading.Tasks; using Key = Ryujinx.Input.Key; @@ -1505,6 +1507,32 @@ namespace Ryujinx.Ava.UI.ViewModels } } + public async Task BulkLoadDlc() + { + var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions + { + Title = LocaleManager.Instance[LocaleKeys.OpenFolderDialogTitle], AllowMultiple = true, + }); + + if (result.Count > 0) + { + var dirs = result.Select(it => it.Path.LocalPath).ToList(); + var numDlcAdded = ApplicationLibrary.AutoLoadDownloadableContents(dirs); + + if (numDlcAdded > 0) + { + var msg = string.Format(LocaleManager.Instance[LocaleKeys.AutoloadDlcAddedMessage], numDlcAdded); + + await Dispatcher.UIThread.InvokeAsync(async () => + { + await ContentDialogHelper.ShowTextDialog( + LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle], + msg, "", "", "", LocaleManager.Instance[LocaleKeys.InputDialogOk], (int)Symbol.Checkmark); + }); + } + } + } + public async Task OpenFolder() { var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions diff --git a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml index ac37361106..ac0662982d 100644 --- a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml +++ b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml @@ -34,6 +34,11 @@ Header="{locale:Locale MenuBarFileOpenUnpacked}" IsEnabled="{Binding EnableNonGameRunningControls}" ToolTip.Tip="{locale:Locale LoadApplicationFolderTooltip}" /> +