diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index ac9c10df0..171b30c26 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -47,7 +47,15 @@ namespace Flow.Launcher.Plugin public delegate ImageSource IconDelegate(); - public IconDelegate Icon; + /// + /// Delegate to Get Image Source + /// + public IconDelegate Icon { get; set; } + + /// + /// Information for Glyph Icon + /// + public GlyphInfo Glyph { get; init; } /// diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index 2f9d06d81..877b82a06 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -42,7 +42,10 @@ + Source="{Binding Image.Value}" Visibility="{Binding ShowImage}" /> + diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index c91bbb107..ce4b23d21 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -66,7 +66,9 @@ namespace Flow.Launcher.ViewModel { OnPropertyChanged(nameof(Image)); }); - } + + Glyph = Result.Glyph; + } Settings = settings; } @@ -74,7 +76,8 @@ namespace Flow.Launcher.ViewModel public Settings Settings { get; private set; } public Visibility ShowOpenResultHotkey => Settings.ShowOpenResultHotkey ? Visibility.Visible : Visibility.Hidden; - + public Visibility ShowIcon => Result.IcoPath != null || Result.Icon is not null || Glyph == null ? Visibility.Visible : Visibility.Hidden; + public Visibility ShowGlyph => Glyph is not null ? Visibility.Visible : Visibility.Hidden; public string OpenResultModifiers => Settings.OpenResultModifiers; public string ShowTitleToolTip => string.IsNullOrEmpty(Result.TitleToolTip) @@ -87,6 +90,8 @@ namespace Flow.Launcher.ViewModel public LazyAsync Image { get; set; } + public GlyphInfo Glyph { get; set; } + private async ValueTask SetImage() { var imagePath = Result.IcoPath; @@ -106,7 +111,7 @@ namespace Flow.Launcher.ViewModel if (ImageLoader.CacheContainImage(imagePath)) // will get here either when icoPath has value\icon delegate is null\when had exception in delegate return ImageLoader.Load(imagePath); - + return await Task.Run(() => ImageLoader.Load(imagePath)); }