diff --git a/Flow.Launcher.Core/ProgressBoxEx.xaml.cs b/Flow.Launcher.Core/ProgressBoxEx.xaml.cs index f5d34617b..00f4a8050 100644 --- a/Flow.Launcher.Core/ProgressBoxEx.xaml.cs +++ b/Flow.Launcher.Core/ProgressBoxEx.xaml.cs @@ -1,4 +1,5 @@ using System; +using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using Flow.Launcher.Infrastructure.Logger; @@ -64,13 +65,18 @@ namespace Flow.Launcher.Core } } - private new void Close() + public async Task CloseAsync() { if (!Application.Current.Dispatcher.CheckAccess()) { - Application.Current.Dispatcher.Invoke(Close); + await Application.Current.Dispatcher.InvokeAsync(Close); } + Close(); + } + + private new void Close() + { if (_isClosed) { return; diff --git a/Flow.Launcher.Plugin/IProgressBoxEx.cs b/Flow.Launcher.Plugin/IProgressBoxEx.cs index 27b061895..50ee6eb55 100644 --- a/Flow.Launcher.Plugin/IProgressBoxEx.cs +++ b/Flow.Launcher.Plugin/IProgressBoxEx.cs @@ -1,4 +1,6 @@ -namespace Flow.Launcher.Plugin; +using System.Threading.Tasks; + +namespace Flow.Launcher.Plugin; /// /// Interface for progress box @@ -16,5 +18,5 @@ public interface IProgressBoxEx /// /// Close progress box. /// - public void Close(); + public Task CloseAsync(); } diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs index 0af2af5ec..f5399d53d 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs @@ -196,7 +196,7 @@ namespace Flow.Launcher.Plugin.PluginsManager if (downloadCancelled) return; else - prgBox?.Close(); + await prgBox?.CloseAsync(); } else { @@ -217,7 +217,7 @@ namespace Flow.Launcher.Plugin.PluginsManager catch (HttpRequestException e) { // force close progress box - prgBox?.Close(); + await prgBox?.CloseAsync(); // show error message Context.API.ShowMsgError( @@ -230,7 +230,7 @@ namespace Flow.Launcher.Plugin.PluginsManager catch (Exception e) { // force close progress box - prgBox?.Close(); + await prgBox?.CloseAsync(); // show error message Context.API.ShowMsgError(Context.API.GetTranslation("plugin_pluginsmanager_install_error_title"),