diff options
author | TSRBerry <20988865+TSRBerry@users.noreply.github.com> | 2023-04-16 09:09:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-16 07:09:02 +0000 |
commit | 6dbcdfea47e60aadefd59a75e43549793481f853 (patch) | |
tree | 84122acbd9faffca6894f32a69e108edcf0fba9a /Ryujinx.Ava/Common/ApplicationHelper.cs | |
parent | c5258cf082b10f335f81487f22b7eeb86075e09e (diff) |
Ava: Fix nca extraction window never closing & minor cleanup (#4569)1.1.712
* 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
Diffstat (limited to 'Ryujinx.Ava/Common/ApplicationHelper.cs')
-rw-r--r-- | Ryujinx.Ava/Common/ApplicationHelper.cs | 31 |
1 files changed, 16 insertions, 15 deletions
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); }); } |