From 95aaa9f08573e8c6926cf62fec9297c71961f34e Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Fri, 23 Dec 2022 17:48:09 +0800 Subject: [PATCH] Add preview delegate --- Flow.Launcher.Plugin/Result.cs | 2 ++ Flow.Launcher/ViewModel/ResultViewModel.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index 912a23a6f..dadf220e3 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -246,12 +246,14 @@ namespace Flow.Launcher.Plugin /// 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, }; } } diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index f0f77d61f..be5dacbfb 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -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);