Add preview delegate

This commit is contained in:
Vic 2022-12-23 17:48:09 +08:00
parent 5970b1c68e
commit 95aaa9f085
2 changed files with 3 additions and 1 deletions

View file

@ -246,12 +246,14 @@ namespace Flow.Launcher.Plugin
/// </summary>
public bool IsMedia { get; set; }
public string Description { get; set; }
public IconDelegate PreviewDelegate { get; set; }
public static PreviewInfo Default { get; } = new()
{
PreviewImagePath = null,
Description = null,
IsMedia = false,
PreviewDelegate = null,
};
}
}

View file

@ -202,7 +202,7 @@ namespace Flow.Launcher.ViewModel
private async Task LoadPreviewImageAsync()
{
var imagePath = string.IsNullOrEmpty(Result.Preview.PreviewImagePath) ? Result.IcoPath : Result.Preview.PreviewImagePath;
var iconDelegate = Result.Icon;
var iconDelegate = Result.Icon ?? Result.Preview.PreviewDelegate;
if (ImageLoader.CacheContainImage(imagePath, true))
{
previewImage = await LoadImageInternalAsync(imagePath, iconDelegate, true).ConfigureAwait(false);