mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Improve code quality
This commit is contained in:
parent
c06ba595b4
commit
07bb16c8f3
1 changed files with 22 additions and 16 deletions
|
|
@ -161,7 +161,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
|
|
||||||
if (canReportProgress &&
|
if (canReportProgress &&
|
||||||
(prgBox = Context.API.ShowProgressBox($"Download {plugin.Name}...", () =>
|
(prgBox = Context.API.ShowProgressBox($"Download {plugin.Name}...", () =>
|
||||||
{
|
{
|
||||||
httpClient.CancelPendingRequests();
|
httpClient.CancelPendingRequests();
|
||||||
downloadCancelled = true;
|
downloadCancelled = true;
|
||||||
prgBox = null;
|
prgBox = null;
|
||||||
|
|
@ -209,32 +209,31 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
filePath = plugin.LocalInstallPath;
|
filePath = plugin.LocalInstallPath;
|
||||||
Install(plugin, filePath);
|
Install(plugin, filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (HttpRequestException e)
|
catch (HttpRequestException e)
|
||||||
{
|
{
|
||||||
|
// force close progress box
|
||||||
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
if (prgBox != null)
|
||||||
|
{
|
||||||
|
prgBox.Close();
|
||||||
|
prgBox = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// show error message
|
||||||
Context.API.ShowMsgError(
|
Context.API.ShowMsgError(
|
||||||
string.Format(Context.API.GetTranslation("plugin_pluginsmanager_downloading_plugin"), plugin.Name),
|
string.Format(Context.API.GetTranslation("plugin_pluginsmanager_downloading_plugin"), plugin.Name),
|
||||||
Context.API.GetTranslation("plugin_pluginsmanager_download_error"));
|
Context.API.GetTranslation("plugin_pluginsmanager_download_error"));
|
||||||
Log.Exception("PluginsManager", "An error occurred while downloading plugin", e);
|
Log.Exception("PluginsManager", "An error occurred while downloading plugin", e);
|
||||||
// force close progress box
|
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
|
||||||
{
|
|
||||||
if (prgBox != null)
|
|
||||||
{
|
|
||||||
prgBox.Close();
|
|
||||||
prgBox = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Context.API.ShowMsgError(Context.API.GetTranslation("plugin_pluginsmanager_install_error_title"),
|
|
||||||
string.Format(Context.API.GetTranslation("plugin_pluginsmanager_install_error_subtitle"),
|
|
||||||
plugin.Name));
|
|
||||||
Log.Exception("PluginsManager", "An error occurred while downloading plugin", e);
|
|
||||||
// force close progress box
|
// force close progress box
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
|
|
@ -244,6 +243,13 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
prgBox = null;
|
prgBox = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// show error message
|
||||||
|
Context.API.ShowMsgError(Context.API.GetTranslation("plugin_pluginsmanager_install_error_title"),
|
||||||
|
string.Format(Context.API.GetTranslation("plugin_pluginsmanager_install_error_subtitle"),
|
||||||
|
plugin.Name));
|
||||||
|
Log.Exception("PluginsManager", "An error occurred while downloading plugin", e);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue