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
675ee9e395
commit
0fabe31fe4
1 changed files with 16 additions and 13 deletions
|
|
@ -163,9 +163,12 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
if (canReportProgress &&
|
||||
(prgBox = Context.API.ShowProgressBox(prgBoxTitle, () =>
|
||||
{
|
||||
httpClient.CancelPendingRequests();
|
||||
downloadCancelled = true;
|
||||
prgBox = null;
|
||||
if (prgBox != null)
|
||||
{
|
||||
httpClient.CancelPendingRequests();
|
||||
downloadCancelled = true;
|
||||
prgBox = null;
|
||||
}
|
||||
})) != null)
|
||||
{
|
||||
await using var contentStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
|
|
@ -185,19 +188,19 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
// check if user cancelled download before reporting progress
|
||||
if (downloadCancelled)
|
||||
return;
|
||||
|
||||
prgBox.ReportProgress(progressValue);
|
||||
else
|
||||
prgBox.ReportProgress(progressValue);
|
||||
}
|
||||
|
||||
// check if user cancelled download before closing progress box
|
||||
if (downloadCancelled)
|
||||
return;
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
prgBox.Close();
|
||||
prgBox = null;
|
||||
});
|
||||
else
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
prgBox.Close();
|
||||
prgBox = null;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -212,8 +215,8 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
// check if user cancelled download before installing plugin
|
||||
if (downloadCancelled)
|
||||
return;
|
||||
|
||||
Install(plugin, filePath);
|
||||
else
|
||||
Install(plugin, filePath);
|
||||
}
|
||||
catch (HttpRequestException e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue