mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Extract duplicate cleanup code into a method
This commit is contained in:
parent
0fabe31fe4
commit
cc0fb66b22
1 changed files with 11 additions and 21 deletions
|
|
@ -196,11 +196,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
if (downloadCancelled)
|
||||
return;
|
||||
else
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
prgBox.Close();
|
||||
prgBox = null;
|
||||
});
|
||||
CleanupProgressBoxEx(prgBox);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -221,14 +217,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
catch (HttpRequestException e)
|
||||
{
|
||||
// force close progress box
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
if (prgBox != null)
|
||||
{
|
||||
prgBox.Close();
|
||||
prgBox = null;
|
||||
}
|
||||
});
|
||||
CleanupProgressBoxEx(prgBox);
|
||||
|
||||
// show error message
|
||||
Context.API.ShowMsgError(
|
||||
|
|
@ -241,14 +230,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
catch (Exception e)
|
||||
{
|
||||
// force close progress box
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
if (prgBox != null)
|
||||
{
|
||||
prgBox.Close();
|
||||
prgBox = null;
|
||||
}
|
||||
});
|
||||
CleanupProgressBoxEx(prgBox);
|
||||
|
||||
// show error message
|
||||
Context.API.ShowMsgError(Context.API.GetTranslation("plugin_pluginsmanager_install_error_title"),
|
||||
|
|
@ -274,6 +256,14 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
}
|
||||
}
|
||||
|
||||
private static void CleanupProgressBoxEx(IProgressBoxEx prgBox)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
prgBox?.Close();
|
||||
});
|
||||
}
|
||||
|
||||
internal async ValueTask<List<Result>> RequestUpdateAsync(string search, CancellationToken token,
|
||||
bool usePrimaryUrlOnly = false)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue