From 6dbcdfea47e60aadefd59a75e43549793481f853 Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Sun, 16 Apr 2023 09:09:02 +0200 Subject: Ava: Fix nca extraction window never closing & minor cleanup (#4569) * ava: Remove unused doWhileDeferred parameters * ava: Minimally improve swkbd dialog It's currently impossible to get the dialog to redirect focus to the InputBox. * ava: Fix nca extraction dialog never closing Also contains some minor cleanup --- Ryujinx.Ava/Common/ApplicationHelper.cs | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'Ryujinx.Ava/Common/ApplicationHelper.cs') diff --git a/Ryujinx.Ava/Common/ApplicationHelper.cs b/Ryujinx.Ava/Common/ApplicationHelper.cs index 161ef859..8c36a636 100644 --- a/Ryujinx.Ava/Common/ApplicationHelper.cs +++ b/Ryujinx.Ava/Common/ApplicationHelper.cs @@ -13,6 +13,7 @@ using LibHac.Tools.Fs; using LibHac.Tools.FsSystem; using LibHac.Tools.FsSystem.NcaUtils; using Ryujinx.Ava.Common.Locale; +using Ryujinx.Ava.UI.Controls; using Ryujinx.Ava.UI.Helpers; using Ryujinx.Ava.UI.Windows; using Ryujinx.Common.Logging; @@ -152,25 +153,17 @@ namespace Ryujinx.Ava.Common string destination = await folderDialog.ShowAsync(_owner); var cancellationToken = new CancellationTokenSource(); + UpdateWaitWindow waitingDialog = new( + LocaleManager.Instance[LocaleKeys.DialogNcaExtractionTitle], + LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogNcaExtractionMessage, ncaSectionType, Path.GetFileName(titleFilePath)), + cancellationToken); + if (!string.IsNullOrWhiteSpace(destination)) { Thread extractorThread = new(() => { - Dispatcher.UIThread.Post(async () => - { - UserResult result = await ContentDialogHelper.CreateConfirmationDialog( - LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogNcaExtractionMessage, ncaSectionType, Path.GetFileName(titleFilePath)), - "", - "", - LocaleManager.Instance[LocaleKeys.InputDialogCancel], - LocaleManager.Instance[LocaleKeys.DialogNcaExtractionTitle]); - - if (result == UserResult.Cancel) - { - cancellationToken.Cancel(); - } - }); - + Dispatcher.UIThread.Post(waitingDialog.Show); + using FileStream file = new(titleFilePath, FileMode.Open, FileAccess.Read); Nca mainNca = null; @@ -222,6 +215,8 @@ namespace Ryujinx.Ava.Common Dispatcher.UIThread.InvokeAsync(async () => { + waitingDialog.Close(); + await ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance[LocaleKeys.DialogNcaExtractionMainNcaNotFoundErrorMessage]); }); @@ -263,11 +258,15 @@ namespace Ryujinx.Ava.Common Dispatcher.UIThread.InvokeAsync(async () => { + waitingDialog.Close(); + await ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance[LocaleKeys.DialogNcaExtractionCheckLogErrorMessage]); }); } else if (resultCode.Value.IsSuccess()) { + Dispatcher.UIThread.Post(waitingDialog.Close); + NotificationHelper.Show( LocaleManager.Instance[LocaleKeys.DialogNcaExtractionTitle], $"{titleName}\n\n{LocaleManager.Instance[LocaleKeys.DialogNcaExtractionSuccessMessage]}", @@ -284,6 +283,8 @@ namespace Ryujinx.Ava.Common Dispatcher.UIThread.InvokeAsync(async () => { + waitingDialog.Close(); + await ContentDialogHelper.CreateErrorDialog(ex.Message); }); } -- cgit v1.2.3