adjustment

This commit is contained in:
2021-08-12 17:29:57 +08:00
parent fa0b033f2a
commit 04ef63ccc3
11 changed files with 116 additions and 26 deletions

View File

@ -111,9 +111,9 @@ namespace Gallery.Util
}
}
public static async Task<ImageSource> LoadRawImage(GalleryItem item, bool force = false, Action<(int loc, int size)> action = null)
public static async Task<ImageSource> LoadRawImage(GalleryItem item, bool downloading, bool force = false, Action<(int loc, int size)> action = null)
{
return await LoadImageAsync(item.RawUrl, null, PersonalFolder, Path.Combine(imageFolder, item.Source), force, action);
return await LoadImageAsync(item.RawUrl, null, PersonalFolder, Path.Combine(imageFolder, item.Source), downloading, force, action);
}
public static string GetRawImagePath(GalleryItem item)
@ -128,10 +128,10 @@ namespace Gallery.Util
public static async Task<ImageSource> LoadPreviewImage(GalleryItem item, bool downloading, bool force = false)
{
return await LoadImage(item.PreviewUrl, CacheFolder, Path.Combine(previewFolder, item.Source), downloading, force: force);
return await LoadImage(item.PreviewUrl, CacheFolder, Path.Combine(previewFolder, item.Source), downloading, force);
}
private static async Task<ImageSource> LoadImage(string url, string working, string folder, bool downloading, bool force = false)
private static async Task<ImageSource> LoadImage(string url, string working, string folder, bool downloading, bool force)
{
var file = Path.Combine(working, folder, Path.GetFileName(url));
ImageSource image;
@ -154,7 +154,7 @@ namespace Gallery.Util
return image;
}
private static async Task<ImageSource> LoadImageAsync(string url, string id, string working, string folder, bool force, Action<(int loc, int size)> action)
private static async Task<ImageSource> LoadImageAsync(string url, string id, string working, string folder, bool downloading, bool force, Action<(int loc, int size)> action)
{
var file = Path.Combine(working, folder, Path.GetFileName(url));
ImageSource image;
@ -166,7 +166,7 @@ namespace Gallery.Util
{
image = null;
}
if (image == null)
if (downloading && image == null)
{
file = await NetHelper.DownloadImageAsync(url, id, working, folder, action);
if (file != null)