mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Switch from WebClient to HTTP
This commit is contained in:
parent
416c44f4c1
commit
ec1a06108d
1 changed files with 10 additions and 13 deletions
|
|
@ -120,21 +120,18 @@ namespace Flow.Launcher.Infrastructure.Image
|
|||
if (IsUriScheme)
|
||||
{
|
||||
// Download image from url
|
||||
using (WebClient client = new WebClient())
|
||||
var resp = Http.Http.GetStreamAsync(path).Result;
|
||||
if (resp == null)
|
||||
{
|
||||
using (MemoryStream stream = new MemoryStream(client.DownloadData(path)))
|
||||
{
|
||||
var image = new BitmapImage();
|
||||
image.BeginInit();
|
||||
image.CacheOption = BitmapCacheOption.OnLoad;
|
||||
image.StreamSource = stream;
|
||||
image.EndInit();
|
||||
image.Freeze();
|
||||
ImageCache[path] = image;
|
||||
return new ImageResult(image, ImageType.Data);
|
||||
}
|
||||
|
||||
return new ImageResult(ImageCache[Constant.MissingImgIcon], ImageType.Error);
|
||||
}
|
||||
var image = new BitmapImage();
|
||||
image.BeginInit();
|
||||
image.StreamSource = resp;
|
||||
image.EndInit();
|
||||
image.Freeze();
|
||||
ImageCache[path] = image;
|
||||
return new ImageResult(image, ImageType.ImageFile);
|
||||
}
|
||||
if (path.StartsWith("data:", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue