From bbe78d96bd43650ecee0399262ec5d90d76b5df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Arrouye?= <5017270+tarrouye@users.noreply.github.com> Date: Mon, 5 Jun 2023 14:07:58 -0700 Subject: [PATCH] Move Task to caller --- .../UI/ViewModels/MainWindowViewModel.cs | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs index f920023cd..12011c82d 100644 --- a/src/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs @@ -1363,7 +1363,7 @@ namespace Ryujinx.Ava.UI.ViewModels if (prevUserId != AccountManager.LastOpenedUser.UserId) { // current user changed, so refresh application metadata - RefreshApplicationsMetadata(); + _ = Task.Run(() => RefreshApplicationsMetadata()); } } @@ -1374,16 +1374,14 @@ namespace Ryujinx.Ava.UI.ViewModels private async void RefreshApplicationsMetadata() { - await Task.Run(() => { - foreach (var app in _applications) - { - var metadata = ApplicationLibrary.LoadAndSaveMetaData(AccountManager.LastOpenedUser.UserId.ToLibHacFsUid(), app.TitleId); - app.Favorite = metadata.Favorite; - app.LastPlayed = metadata.LastPlayed; - app.TimePlayedNum = metadata.TimePlayed; - app.TimePlayed = ApplicationLibrary.ConvertSecondsToFormattedString(metadata.TimePlayed); - } - }); + foreach (var app in _applications) + { + var metadata = ApplicationLibrary.LoadAndSaveMetaData(AccountManager.LastOpenedUser.UserId.ToLibHacFsUid(), app.TitleId); + app.Favorite = metadata.Favorite; + app.LastPlayed = metadata.LastPlayed; + app.TimePlayedNum = metadata.TimePlayed; + app.TimePlayed = ApplicationLibrary.ConvertSecondsToFormattedString(metadata.TimePlayed); + } RefreshView(); }