mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Load large Thumbnail when load full image
This commit is contained in:
parent
65d4aeddea
commit
250627a27a
2 changed files with 7 additions and 9 deletions
|
|
@ -23,6 +23,7 @@ namespace Flow.Launcher.Infrastructure.Image
|
|||
private static readonly bool EnableImageHash = true;
|
||||
public static ImageSource DefaultImage { get; } = new BitmapImage(new Uri(Constant.MissingImgIcon));
|
||||
public const int SmallIconSize = 32;
|
||||
public const int FullIconSize = 256;
|
||||
|
||||
|
||||
private static readonly string[] ImageExtensions =
|
||||
|
|
@ -217,7 +218,7 @@ namespace Flow.Launcher.Infrastructure.Image
|
|||
else
|
||||
{
|
||||
type = ImageType.File;
|
||||
image = GetThumbnail(path, ThumbnailOptions.None);
|
||||
image = GetThumbnail(path, ThumbnailOptions.None, loadFullImage ? FullIconSize : SmallIconSize);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -234,12 +235,12 @@ namespace Flow.Launcher.Infrastructure.Image
|
|||
return new ImageResult(image, type);
|
||||
}
|
||||
|
||||
private static BitmapSource GetThumbnail(string path, ThumbnailOptions option = ThumbnailOptions.ThumbnailOnly)
|
||||
private static BitmapSource GetThumbnail(string path, ThumbnailOptions option = ThumbnailOptions.ThumbnailOnly, int size = SmallIconSize)
|
||||
{
|
||||
return WindowsThumbnailProvider.GetThumbnail(
|
||||
path,
|
||||
Constant.ThumbnailSize,
|
||||
Constant.ThumbnailSize,
|
||||
size,
|
||||
size,
|
||||
option);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -199,13 +199,10 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
|
||||
|
||||
private async ValueTask LoadPreviewImageAsync()
|
||||
private async Task LoadPreviewImageAsync()
|
||||
{
|
||||
var imagePath = Result.PreviewImage ?? Result.IcoPath;
|
||||
var loadFullImage = (Path.GetExtension(imagePath) ?? "").Equals(".url", StringComparison.OrdinalIgnoreCase);
|
||||
// We need to modify the property not field here to trigger the OnPropertyChanged event
|
||||
//PreviewImage = await Task.Run(() => ImageLoader.Load(imagePath, true)).ConfigureAwait(false);
|
||||
PreviewImage = await ImageLoader.LoadAsync(imagePath, loadFullImage).ConfigureAwait(false);
|
||||
PreviewImage = await ImageLoader.LoadAsync(imagePath, true).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public Result Result { get; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue