mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Improve progress box when exception happens
This commit is contained in:
parent
297d191412
commit
cc921c7d29
1 changed files with 10 additions and 2 deletions
|
|
@ -145,6 +145,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
var filePath = Path.Combine(Path.GetTempPath(), downloadFilename);
|
||||
|
||||
var downloadCancelled = false;
|
||||
var exceptionHappened = false;
|
||||
try
|
||||
{
|
||||
if (!plugin.IsFromLocalInstallPath)
|
||||
|
|
@ -168,8 +169,10 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
{
|
||||
if (reportProgress == null)
|
||||
{
|
||||
// cannot use progress box
|
||||
await Http.DownloadAsync(plugin.UrlDownload, filePath).ConfigureAwait(false);
|
||||
// when reportProgress is null, it means there is expcetion with the progress box
|
||||
// so we record it with exceptionHappened and return so that progress box will close instantly
|
||||
exceptionHappened = true;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -200,6 +203,11 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
cts.Cancel();
|
||||
downloadCancelled = true;
|
||||
});
|
||||
|
||||
// if exception happened while downloading and user does not cancel downloading,
|
||||
// we need to redownload the plugin
|
||||
if (exceptionHappened && (!downloadCancelled))
|
||||
await Http.DownloadAsync(plugin.UrlDownload, filePath).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue