From d6d3cdd5739e6b8f8df36bf393e440f4857fb2b7 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz <42140194+IsaacMarovitz@users.noreply.github.com> Date: Mon, 25 Sep 2023 18:04:58 -0400 Subject: Ava UI: Refactor `async` usage (#5516) * Remove `async void` * Async LoadApplications * Formatting and such * Remove async from InstallUpdate * Update src/Ryujinx.Ava/UI/Controls/ApplicationContextMenu.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Cleanup LoadApplications() * Cleanup * Formatting * Revert some stuff * Cleanup * Update src/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs Co-authored-by: Ac_K * Ack suggestions * Whitespace * Fix Peri suggestion * Add missing trailing commas * Remove redundant method override * Remove Dispatcher.UIThread.InvokeAsync/Post where possible --------- Co-authored-by: TSR Berry <20988865+TSRBerry@users.noreply.github.com> Co-authored-by: Ac_K --- src/Ryujinx.Ava/UI/ViewModels/TitleUpdateViewModel.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/Ryujinx.Ava/UI/ViewModels/TitleUpdateViewModel.cs') diff --git a/src/Ryujinx.Ava/UI/ViewModels/TitleUpdateViewModel.cs b/src/Ryujinx.Ava/UI/ViewModels/TitleUpdateViewModel.cs index e3bca205..dd0b92a5 100644 --- a/src/Ryujinx.Ava/UI/ViewModels/TitleUpdateViewModel.cs +++ b/src/Ryujinx.Ava/UI/ViewModels/TitleUpdateViewModel.cs @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Threading.Tasks; using Path = System.IO.Path; using SpanHelpers = LibHac.Common.SpanHelpers; @@ -184,18 +185,12 @@ namespace Ryujinx.Ava.UI.ViewModels } else { - Dispatcher.UIThread.Post(async () => - { - await ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance[LocaleKeys.DialogUpdateAddUpdateErrorMessage]); - }); + Dispatcher.UIThread.InvokeAsync(() => ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance[LocaleKeys.DialogUpdateAddUpdateErrorMessage])); } } catch (Exception ex) { - Dispatcher.UIThread.Post(async () => - { - await ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogLoadNcaErrorMessage, ex.Message, path)); - }); + Dispatcher.UIThread.InvokeAsync(() => ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogLoadNcaErrorMessage, ex.Message, path))); } } } @@ -207,7 +202,7 @@ namespace Ryujinx.Ava.UI.ViewModels SortUpdates(); } - public async void Add() + public async Task Add() { var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions { @@ -218,9 +213,9 @@ namespace Ryujinx.Ava.UI.ViewModels { Patterns = new[] { "*.nsp" }, AppleUniformTypeIdentifiers = new[] { "com.ryujinx.nsp" }, - MimeTypes = new[] { "application/x-nx-nsp" } - } - } + MimeTypes = new[] { "application/x-nx-nsp" }, + }, + }, }); foreach (var file in result) -- cgit v1.2.3