add Http.DownloadAsync

This commit is contained in:
弘韬 张 2021-01-08 16:05:50 +08:00
parent a3975a3531
commit bd74a87d08
2 changed files with 10 additions and 1 deletions

View file

@ -1,4 +1,5 @@
using Flow.Launcher.Plugin.SharedModel;
using JetBrains.Annotations;
using System;
using System.Collections.Generic;
using System.IO;
@ -92,5 +93,7 @@ namespace Flow.Launcher.Plugin
Task<string> HttpGetStringAsync(string url, CancellationToken token = default);
Task<Stream> HttpGetStreamAsync(string url, CancellationToken token = default);
Task HttpDownloadAsync([NotNull] string url, [NotNull] string filePath);
}
}

View file

@ -18,6 +18,7 @@ using Flow.Launcher.Plugin.SharedModel;
using System.Threading;
using System.IO;
using Flow.Launcher.Infrastructure.Http;
using JetBrains.Annotations;
namespace Flow.Launcher
{
@ -96,7 +97,7 @@ namespace Flow.Launcher
{
Application.Current.Dispatcher.Invoke(() =>
{
var msg = useMainWindowAsOwner ? new Msg {Owner = Application.Current.MainWindow} : new Msg();
var msg = useMainWindowAsOwner ? new Msg { Owner = Application.Current.MainWindow } : new Msg();
msg.Show(title, subTitle, iconPath);
});
}
@ -143,6 +144,11 @@ namespace Flow.Launcher
return Http.GetStreamAsync(url);
}
public Task HttpDownloadAsync([NotNull] string url, [NotNull] string filePath)
{
return Http.DownloadAsync(url, filePath);
}
#endregion
#region Private Methods