main keybinding & svg support

This commit is contained in:
Hongtao Zhang 2024-01-19 12:12:44 -06:00
parent 9555007690
commit c4c18609b4
14 changed files with 199 additions and 206 deletions

View file

@ -49,6 +49,7 @@
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.7" />
<PackageReference Include="Avalonia.Svg" Version="11.0.0.10" />
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
<PackageReference Include="Fody" Version="6.5.5">
<PrivateAssets>all</PrivateAssets>

View file

@ -5,6 +5,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Media;
using Avalonia.Media;
using Avalonia.Media.Imaging;
namespace Flow.Launcher.Infrastructure.Image
@ -13,9 +14,9 @@ namespace Flow.Launcher.Infrastructure.Image
public class ImageUsage
{
public int usage;
public Bitmap imageSource;
public IImage imageSource;
public ImageUsage(int usage, Bitmap image)
public ImageUsage(int usage, IImage image)
{
this.usage = usage;
imageSource = image;
@ -37,7 +38,7 @@ namespace Flow.Launcher.Infrastructure.Image
}
}
public Bitmap this[string path, bool isFullImage = false]
public IImage this[string path, bool isFullImage = false]
{
get
{
@ -89,7 +90,7 @@ namespace Flow.Launcher.Infrastructure.Image
Data[(key, isFullImage)].imageSource != null;
}
public bool TryGetValue(string key, bool isFullImage, out Bitmap image)
public bool TryGetValue(string key, bool isFullImage, out IImage image)
{
if (key is not null)
{

View file

@ -7,7 +7,10 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Avalonia.Media;
using Avalonia.Media.Imaging;
using Avalonia.Svg;
using Avalonia.Threading;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.Storage;
using static Flow.Launcher.Infrastructure.Http.Http;
@ -91,10 +94,10 @@ namespace Flow.Launcher.Infrastructure.Image
}
}
private readonly record struct ImageResult(Bitmap image, ImageType imageType)
private readonly record struct ImageResult(IImage image, ImageType imageType)
{
public ImageType ImageType { get; } = imageType;
public Bitmap Image { get; } = image;
public IImage Image { get; } = image;
}
private enum ImageType
@ -184,7 +187,7 @@ namespace Flow.Launcher.Infrastructure.Image
private static async ValueTask<ImageResult> GetThumbnailResult(string path, bool loadFullImage = false)
{
Bitmap image;
IImage image;
ImageType type = ImageType.Error;
if (Directory.Exists(path))
@ -218,6 +221,12 @@ namespace Flow.Launcher.Infrastructure.Image
image = await ImageHelper.LoadFromFile(path, SmallIconSize);
}
}
else if (extension == ".svg")
{
var source = SvgSource.Load(path, null);
image = Dispatcher.UIThread.Invoke(() => new SvgImage() { Source = source });
type = ImageType.FullImageFile;
}
else
{
type = ImageType.File;
@ -249,12 +258,12 @@ namespace Flow.Launcher.Infrastructure.Image
return ImageCache.ContainsKey(path, loadFullImage);
}
public static bool TryGetValue(string path, bool loadFullImage, out Bitmap image)
public static bool TryGetValue(string path, bool loadFullImage, out IImage image)
{
return ImageCache.TryGetValue(path, loadFullImage, out image);
}
public static async ValueTask<Bitmap> LoadAsync(string path, bool loadFullImage = false)
public static async ValueTask<IImage> LoadAsync(string path, bool loadFullImage = false)
{
var imageResult = await LoadInternalAsync(path, loadFullImage);

View file

@ -5,7 +5,7 @@
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
<Application.Resources>
<FontFamily x:Key="UIFont">avares://Flow.Launcher/Resources/#Segoe Fluent Icons</FontFamily>
<FontFamily x:Key="IconFont">avares://Flow.Launcher/Resources/#Segoe Fluent Icons</FontFamily>
</Application.Resources>
<Application.Styles>

View file

@ -101,6 +101,7 @@
<PackageReference Include="Avalonia.Desktop" Version="11.0.7" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.7" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.7" />
<PackageReference Include="Avalonia.Svg" Version="11.0.0.10" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.7" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.7"/>

View file

@ -32,154 +32,122 @@
<converters:BoolToIMEStateConverter x:Key="BoolToIMEStateConverter" />
<converters:StringToKeyBindingConverter x:Key="StringToKeyBindingConverter" />
</Window.Resources>
<!-- <Window.InputBindings> -->
<!-- <KeyBinding Key="Escape" Command="{Binding EscCommand}" /> -->
<!-- <KeyBinding Key="F5" Command="{Binding ReloadPluginDataCommand}" /> -->
<!-- <KeyBinding Key="Tab" Command="{Binding AutocompleteQueryCommand}" /> -->
<!-- <KeyBinding -->
<!-- Key="Tab" -->
<!-- Command="{Binding AutocompleteQueryCommand}" -->
<!-- Modifiers="Shift" /> -->
<!-- <KeyBinding -->
<!-- Key="I" -->
<!-- Command="{Binding OpenSettingCommand}" -->
<!-- Modifiers="Ctrl" /> -->
<!-- <KeyBinding -->
<!-- Key="N" -->
<!-- Command="{Binding SelectNextItemCommand}" -->
<!-- Modifiers="Ctrl" /> -->
<!-- <KeyBinding -->
<!-- Key="J" -->
<!-- Command="{Binding SelectNextItemCommand}" -->
<!-- Modifiers="Ctrl" /> -->
<!-- <KeyBinding -->
<!-- Key="D" -->
<!-- Command="{Binding SelectNextPageCommand}" -->
<!-- Modifiers="Ctrl" /> -->
<!-- <KeyBinding -->
<!-- Key="P" -->
<!-- Command="{Binding SelectPrevItemCommand}" -->
<!-- Modifiers="Ctrl" /> -->
<!-- <KeyBinding -->
<!-- Key="K" -->
<!-- Command="{Binding SelectPrevItemCommand}" -->
<!-- Modifiers="Ctrl" /> -->
<!-- <KeyBinding -->
<!-- Key="U" -->
<!-- Command="{Binding SelectPrevPageCommand}" -->
<!-- Modifiers="Ctrl" /> -->
<!-- <KeyBinding -->
<!-- Key="Home" -->
<!-- Command="{Binding SelectFirstResultCommand}" -->
<!-- Modifiers="Alt" /> -->
<!-- <KeyBinding -->
<!-- Key="O" -->
<!-- Command="{Binding LoadContextMenuCommand}" -->
<!-- Modifiers="Ctrl" /> -->
<!-- <KeyBinding -->
<!-- Key="R" -->
<!-- Command="{Binding ReQueryCommand}" -->
<!-- Modifiers="Ctrl" /> -->
<!-- <KeyBinding -->
<!-- Key="H" -->
<!-- Command="{Binding LoadHistoryCommand}" -->
<!-- Modifiers="Ctrl" /> -->
<!-- <KeyBinding -->
<!-- Key="OemCloseBrackets" -->
<!-- Command="{Binding IncreaseWidthCommand}" -->
<!-- Modifiers="Control" /> -->
<!-- <KeyBinding -->
<!-- Key="OemOpenBrackets" -->
<!-- Command="{Binding DecreaseWidthCommand}" -->
<!-- Modifiers="Control" /> -->
<!-- <KeyBinding -->
<!-- Key="OemPlus" -->
<!-- Command="{Binding IncreaseMaxResultCommand}" -->
<!-- Modifiers="Control" /> -->
<!-- <KeyBinding -->
<!-- Key="OemMinus" -->
<!-- Command="{Binding DecreaseMaxResultCommand}" -->
<!-- Modifiers="Control" /> -->
<!-- <KeyBinding -->
<!-- Key="H" -->
<!-- Command="{Binding LoadHistoryCommand}" -->
<!-- Modifiers="Ctrl" /> -->
<!-- <KeyBinding -->
<!-- Key="Enter" -->
<!-- Command="{Binding OpenResultCommand}" -->
<!-- Modifiers="Ctrl+Shift" /> -->
<!-- <KeyBinding -->
<!-- Key="Enter" -->
<!-- Command="{Binding LoadContextMenuCommand}" -->
<!-- Modifiers="Shift" /> -->
<!-- <KeyBinding Key="Enter" Command="{Binding OpenResultCommand}" /> -->
<!-- <KeyBinding -->
<!-- Key="Enter" -->
<!-- Command="{Binding OpenResultCommand}" -->
<!-- Modifiers="Ctrl" /> -->
<!-- <KeyBinding -->
<!-- Key="Enter" -->
<!-- Command="{Binding OpenResultCommand}" -->
<!-- Modifiers="Alt" /> -->
<!-- <KeyBinding -->
<!-- Key="D1" -->
<!-- Command="{Binding OpenResultCommand}" -->
<!-- CommandParameter="0" -->
<!-- Modifiers="{Binding OpenResultCommandModifiers}" /> -->
<!-- <KeyBinding -->
<!-- Key="D2" -->
<!-- Command="{Binding OpenResultCommand}" -->
<!-- CommandParameter="1" -->
<!-- Modifiers="{Binding OpenResultCommandModifiers}" /> -->
<!-- <KeyBinding -->
<!-- Key="D3" -->
<!-- Command="{Binding OpenResultCommand}" -->
<!-- CommandParameter="2" -->
<!-- Modifiers="{Binding OpenResultCommandModifiers}" /> -->
<!-- <KeyBinding -->
<!-- Key="D4" -->
<!-- Command="{Binding OpenResultCommand}" -->
<!-- CommandParameter="3" -->
<!-- Modifiers="{Binding OpenResultCommandModifiers}" /> -->
<!-- <KeyBinding -->
<!-- Key="D5" -->
<!-- Command="{Binding OpenResultCommand}" -->
<!-- CommandParameter="4" -->
<!-- Modifiers="{Binding OpenResultCommandModifiers}" /> -->
<!-- <KeyBinding -->
<!-- Key="D6" -->
<!-- Command="{Binding OpenResultCommand}" -->
<!-- CommandParameter="5" -->
<!-- Modifiers="{Binding OpenResultCommandModifiers}" /> -->
<!-- <KeyBinding -->
<!-- Key="D7" -->
<!-- Command="{Binding OpenResultCommand}" -->
<!-- CommandParameter="6" -->
<!-- Modifiers="{Binding OpenResultCommandModifiers}" /> -->
<!-- <KeyBinding -->
<!-- Key="D8" -->
<!-- Command="{Binding OpenResultCommand}" -->
<!-- CommandParameter="7" -->
<!-- Modifiers="{Binding OpenResultCommandModifiers}" /> -->
<!-- <KeyBinding -->
<!-- Key="D9" -->
<!-- Command="{Binding OpenResultCommand}" -->
<!-- CommandParameter="8" -->
<!-- Modifiers="{Binding OpenResultCommandModifiers}" /> -->
<!-- <KeyBinding -->
<!-- Key="D0" -->
<!-- Command="{Binding OpenResultCommand}" -->
<!-- CommandParameter="9" -->
<!-- Modifiers="{Binding OpenResultCommandModifiers}" /> -->
<!-- <KeyBinding -->
<!-- Key="F12" -->
<!-- Command="{Binding ToggleGameModeCommand}" -->
<!-- Modifiers="Ctrl" /> -->
<!-- <KeyBinding -->
<!-- Key="{Binding PreviewHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}" -->
<!-- Command="{Binding TogglePreviewCommand}" -->
<!-- Modifiers="{Binding PreviewHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" /> -->
<!-- </Window.InputBindings> -->
<Window.KeyBindings>
<KeyBinding Gesture="Escape" Command="{Binding EscCommand}" />
<KeyBinding Gesture="F5" Command="{Binding ReloadPluginDataCommand}" />
<KeyBinding Gesture="Tab" Command="{Binding AutocompleteQueryCommand}" />
<KeyBinding
Gesture="Shift+Tab"
Command="{Binding AutocompleteQueryCommand}" />
<KeyBinding
Gesture="Ctrl+I"
Command="{Binding OpenSettingCommand}" />
<KeyBinding
Gesture="Ctrl+N"
Command="{Binding SelectNextItemCommand}" />
<KeyBinding
Gesture="Ctrl+J"
Command="{Binding SelectNextItemCommand}" />
<KeyBinding
Gesture="Ctrl+D"
Command="{Binding SelectNextPageCommand}" />
<KeyBinding
Gesture="Ctrl+P"
Command="{Binding SelectPrevItemCommand}" />
<KeyBinding
Gesture="Ctrl+K"
Command="{Binding SelectPrevItemCommand}" />
<KeyBinding
Gesture="Ctrl+U"
Command="{Binding SelectPrevPageCommand}" />
<KeyBinding
Gesture="Alt+Home"
Command="{Binding SelectFirstResultCommand}" />
<KeyBinding
Gesture="Ctrl+O"
Command="{Binding LoadContextMenuCommand}" />
<KeyBinding
Gesture="Ctrl+R"
Command="{Binding ReQueryCommand}" />
<KeyBinding
Gesture="Ctrl+H"
Command="{Binding LoadHistoryCommand}" />
<KeyBinding
Gesture="Ctrl+OemCloseBrackets"
Command="{Binding IncreaseWidthCommand}" />
<KeyBinding
Gesture="Ctrl+OemOpenBrackets"
Command="{Binding DecreaseWidthCommand}" />
<KeyBinding
Gesture="Ctrl+OemPlus"
Command="{Binding IncreaseMaxResultCommand}" />
<KeyBinding
Gesture="Ctrl+OemMinus"
Command="{Binding DecreaseMaxResultCommand}" />
<KeyBinding
Gesture="Ctrl+H"
Command="{Binding LoadHistoryCommand}" />
<KeyBinding
Gesture="Ctrl+Shift+Enter"
Command="{Binding OpenResultCommand}" />
<KeyBinding
Gesture="Shift+Enter"
Command="{Binding LoadContextMenuCommand}" />
<KeyBinding Gesture="Enter" Command="{Binding OpenResultCommand}" />
<KeyBinding
Gesture="Ctrl+Enter"
Command="{Binding OpenResultCommand}" />
<KeyBinding
Gesture="Alt+Enter"
Command="{Binding OpenResultCommand}" />
<KeyBinding
Gesture="{Binding D1Gesture}"
Command="{Binding OpenResultCommand}"
CommandParameter="0" />
<KeyBinding
Gesture="{Binding D2Gesture}"
Command="{Binding OpenResultCommand}"
CommandParameter="1" />
<KeyBinding
Gesture="{Binding D3Gesture}"
Command="{Binding OpenResultCommand}"
CommandParameter="2" />
<KeyBinding
Gesture="{Binding D4Gesture}"
Command="{Binding OpenResultCommand}"
CommandParameter="3" />
<KeyBinding
Gesture="{Binding D5Gesture}"
Command="{Binding OpenResultCommand}"
CommandParameter="4" />
<KeyBinding
Gesture="{Binding D6Gesture}"
Command="{Binding OpenResultCommand}"
CommandParameter="5" />
<KeyBinding
Gesture="{Binding D7Gesture}"
Command="{Binding OpenResultCommand}"
CommandParameter="6" />
<KeyBinding
Gesture="{Binding D8Gesture}"
Command="{Binding OpenResultCommand}"
CommandParameter="7" />
<KeyBinding
Gesture="{Binding D9Gesture}"
Command="{Binding OpenResultCommand}"
CommandParameter="8" />
<KeyBinding
Gesture="{Binding D0Gesture}"
Command="{Binding OpenResultCommand}"
CommandParameter="9" />
<KeyBinding
Gesture="Ctrl+F12"
Command="{Binding ToggleGameModeCommand}" />
<KeyBinding
Gesture="{Binding PreviewHotkey}"
Command="{Binding TogglePreviewCommand}" />
</Window.KeyBindings>
<Grid>
<Border PointerPressed="OnMouseDown">
<StackPanel Orientation="Vertical">
@ -208,7 +176,7 @@
<ContextMenu MinWidth="160">
<!-- <MenuItem Command="ApplicationCommands.Cut" Header="{DynamicResource cut}"> -->
<!-- <MenuItem.Icon> -->
<!-- <ui:FontIcon Glyph="&#xe8c6;" /> -->
<!-- <TextBlock Text="&#xe8c6;" /> -->
<!-- </MenuItem.Icon> -->
<!-- </MenuItem> -->
<!-- <MenuItem Command="ApplicationCommands.Copy" Header="{DynamicResource copy}"> -->
@ -228,14 +196,14 @@
<MenuItem Click="OnContextMenusForSettingsClick"
Header="{DynamicResource flowlauncher_settings}">
<MenuItem.Icon>
<!-- <FontIcon Glyph="&#xe713;" /> -->
<TextBlock Text="&#xe713;" FontFamily="{StaticResource IconFont}" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="{Binding EscCommand}" Header="{DynamicResource closeWindow}">
<MenuItem.Icon>
<TextBlock Text="&#xe711;" FontFamily="{StaticResource IconFont}" />
</MenuItem.Icon>
</MenuItem>
<!-- <MenuItem Command="{Binding EscCommand}" Header="{DynamicResource closeWindow}"> -->
<!-- <MenuItem.Icon> -->
<!-- <ui:FontIcon Glyph="&#xe711;" /> -->
<!-- </MenuItem.Icon> -->
<!-- </MenuItem> -->
</ContextMenu>
</TextBox.ContextMenu>
</TextBox>
@ -335,28 +303,28 @@
<!-- </Border.Clip> -->
<flowlauncher:ResultListBox x:Name="ResultListBox" />
</Border>
<!-- <Border DataContext="{Binding ContextMenu}"> -->
<!-- <Border.Clip> -->
<!-- ~1~ <MultiBinding Converter="{StaticResource BorderClipConverter}"> @1@ -->
<!-- ~1~ <Binding Path="Width" RelativeSource="{RelativeSource Self}" /> @1@ -->
<!-- ~1~ <Binding Path="Height" RelativeSource="{RelativeSource Self}" /> @1@ -->
<!-- ~1~ <Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}" /> @1@ -->
<!-- ~1~ </MultiBinding> @1@ -->
<!-- </Border.Clip> -->
<!-- <flowlauncher:ResultListBox -->
<!-- x:Name="ContextMenu" /> -->
<!-- </Border> -->
<!-- <Border DataContext="{Binding History}"> -->
<!-- <Border.Clip> -->
<!-- ~1~ <MultiBinding Converter="{StaticResource BorderClipConverter}"> @1@ -->
<!-- ~1~ <Binding Path="Width" RelativeSource="{RelativeSource Self}" /> @1@ -->
<!-- ~1~ <Binding Path="Height" RelativeSource="{RelativeSource Self}" /> @1@ -->
<!-- ~1~ <Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}" /> @1@ -->
<!-- ~1~ </MultiBinding> @1@ -->
<!-- </Border.Clip> -->
<!-- <flowlauncher:ResultListBox -->
<!-- x:Name="History" /> -->
<!-- </Border> -->
<Border DataContext="{Binding ContextMenu}">
<Border.Clip>
<!-- <MultiBinding Converter="{StaticResource BorderClipConverter}"> -->
<!-- <Binding Path="Width" RelativeSource="{RelativeSource Self}" /> -->
<!-- <Binding Path="Height" RelativeSource="{RelativeSource Self}" /> -->
<!-- <Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}" /> -->
<!-- </MultiBinding> -->
</Border.Clip>
<flowlauncher:ResultListBox
x:Name="ContextMenu" />
</Border>
<Border DataContext="{Binding History}">
<Border.Clip>
<!-- <MultiBinding Converter="{StaticResource BorderClipConverter}"> -->
<!-- <Binding Path="Width" RelativeSource="{RelativeSource Self}" /> -->
<!-- <Binding Path="Height" RelativeSource="{RelativeSource Self}" /> -->
<!-- <Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}" /> -->
<!-- </MultiBinding> -->
</Border.Clip>
<flowlauncher:ResultListBox
x:Name="History" />
</Border>
</StackPanel>
<!-- <GridSplitter -->
<!-- Grid.Column="1" -->

View file

@ -347,7 +347,7 @@ namespace Flow.Launcher
private void OpenWelcomeWindow()
{
var WelcomeWindow = new WelcomeWindow(_settings);
WelcomeWindow.ShowDialog(this);
WelcomeWindow.Show(this);
}
private async void PositionReset()

View file

@ -63,12 +63,7 @@
</TextBlock>
</StackPanel>
<Grid Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" ColumnDefinitions="Auto,*">
<Border
x:Name="Bullet"
Grid.Column="0" />
@ -97,7 +92,7 @@
x:Name="GlyphIcon"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{Binding Glyph.FontFamily}"
FontFamily="{StaticResource IconFont}"
Text="{Binding Glyph.Glyph}"
IsVisible="{Binding ShowGlyph}" />
</Border>

View file

@ -258,7 +258,7 @@ namespace Flow.Launcher
private void OpenWelcomeWindow(object sender, RoutedEventArgs e)
{
var WelcomeWindow = new WelcomeWindow(settings);
WelcomeWindow.ShowDialog(null);
WelcomeWindow.Show();
}
private void OpenLogFolder(object sender, RoutedEventArgs e)
{

View file

@ -599,7 +599,17 @@ namespace Flow.Launcher.ViewModel
public string PluginIconPath { get; set; } = null;
public string OpenResultCommandModifiers => Settings.OpenResultModifiers;
public string D1Gesture => $"{OpenResultCommandModifiers}+D1";
public string D2Gesture => $"{OpenResultCommandModifiers}+D2";
public string D3Gesture => $"{OpenResultCommandModifiers}+D3";
public string D4Gesture => $"{OpenResultCommandModifiers}+D4";
public string D5Gesture => $"{OpenResultCommandModifiers}+D5";
public string D6Gesture => $"{OpenResultCommandModifiers}+D6";
public string D7Gesture => $"{OpenResultCommandModifiers}+D7";
public string D8Gesture => $"{OpenResultCommandModifiers}+D8";
public string D9Gesture => $"{OpenResultCommandModifiers}+D9";
public string D0Gesture => $"{OpenResultCommandModifiers}+D0";
public string PreviewHotkey
{
get

View file

@ -9,7 +9,11 @@ using Flow.Launcher.Plugin;
using System.IO;
using System.Drawing.Text;
using System.Collections.Generic;
using Avalonia.Fonts.Inter;
using Avalonia.Media;
using Avalonia.Media.Fonts;
using Avalonia.Media.Imaging;
using FontFamily = Avalonia.Media.FontFamily;
namespace Flow.Launcher.ViewModel
{
@ -17,7 +21,7 @@ namespace Flow.Launcher.ViewModel
{
private static PrivateFontCollection fontCollection = new();
private static Dictionary<string, string> fonts = new();
public ResultViewModel(Result result, Settings settings)
{
Settings = settings;
@ -59,14 +63,17 @@ namespace Flow.Launcher.ViewModel
}
}
LoadImage();
}
private Settings Settings { get; }
public bool ShowOpenResultHotkey => Settings.ShowOpenResultHotkey;
public Bitmap DefaultImage => ImageLoader.LoadingImage;
public IImage DefaultImage => ImageLoader.LoadingImage;
public bool ShowDefaultPreview => Result.PreviewPanel != null;
@ -148,9 +155,9 @@ namespace Flow.Launcher.ViewModel
? Result.SubTitle
: Result.SubTitleToolTip;
public Task<Bitmap> Image { get; set; }
public Task<IImage> Image { get; set; }
public Task<Bitmap> PreviewImage { get; set; }
public Task<IImage> PreviewImage { get; set; }
/// <summary>
/// Determines if to use the full width of the preview panel
@ -159,7 +166,7 @@ namespace Flow.Launcher.ViewModel
public GlyphInfo Glyph { get; set; }
private async Task<Bitmap> LoadImageInternalAsync(string imagePath, Result.IconDelegate icon,
private async Task<IImage> LoadImageInternalAsync(string imagePath, Result.IconDelegate icon,
bool loadFullImage)
{
if (string.IsNullOrEmpty(imagePath) && icon != null)

View file

@ -105,7 +105,7 @@
Margin="8,5,0,5"
Content="&#xe76c;"
DockPanel.Dock="Right"
FontFamily="{StaticResource UIFont}"
FontFamily="{StaticResource IconFont}"
FontSize="18" />
<Button
x:Name="BackButton"
@ -114,7 +114,7 @@
Command="{Binding NavigatePreviousCommand}"
Content="&#xe76b;"
DockPanel.Dock="Right"
FontFamily="{StaticResource UIFont}"
FontFamily="{StaticResource IconFont}"
FontSize="18" />
<StackPanel />
</DockPanel>

View file

@ -174,7 +174,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
Title = title,
AutoCompleteText = resultName,
SubTitle = subtitle,
IcoPath = IcoPath,
IcoPath = @"C:\Users\hongt\Downloads\Vector-based_example.svg", // IcoPath,
Score = matchResult.Score,
TitleHighlightData = matchResult.MatchData,
ContextData = this,

View file

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using System.Windows;
#pragma warning restore IDE0005
using System.Windows.Media;
using Avalonia.Media;
using Avalonia.Media.Imaging;
namespace Flow.Launcher.Plugin.WebSearch
@ -60,7 +61,7 @@ namespace Flow.Launcher.Plugin.WebSearch
return Directory.GetParent(fullPathToSelectedImage).ToString() == Main.DefaultImagesDirectory;
}
internal async ValueTask<Bitmap> LoadPreviewIconAsync(string pathToPreviewIconImage)
internal async ValueTask<IImage> LoadPreviewIconAsync(string pathToPreviewIconImage)
{
return await ImageLoader.LoadAsync(pathToPreviewIconImage);
}