From 4572068e768921e0834c53f6f4192c71ae762c04 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Wed, 2 Apr 2025 18:25:28 +0800 Subject: [PATCH] Use api functions in plugin projects --- .../Views/PreviewPanel.xaml.cs | 3 +-- .../SearchSourceViewModel.cs | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs index 878832e4f..aaf1efdc1 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs @@ -7,7 +7,6 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Imaging; -using Flow.Launcher.Infrastructure.Image; using Flow.Launcher.Plugin.Explorer.Search; namespace Flow.Launcher.Plugin.Explorer.Views; @@ -89,7 +88,7 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged private async Task LoadImageAsync() { - PreviewImage = await ImageLoader.LoadAsync(FilePath, true).ConfigureAwait(false); + PreviewImage = await Main.Context.API.LoadImageAsync(FilePath, true).ConfigureAwait(false); } public event PropertyChangedEventHandler? PropertyChanged; diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs index 9c5e81cb5..6554edd83 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs @@ -1,5 +1,4 @@ -using Flow.Launcher.Infrastructure.Image; -using System; +using System; using System.IO; using System.Threading.Tasks; #pragma warning disable IDE0005 @@ -41,8 +40,8 @@ namespace Flow.Launcher.Plugin.WebSearch #if DEBUG throw; #else - Main._context.API.ShowMsgBox(string.Format("Copying the selected image file to {0} has failed, changes will now be reverted", destinationFileNameFullPath)); - UpdateIconAttributes(selectedSearchSource, fullPathToOriginalImage); + Main._context.API.ShowMsgBox(string.Format("Copying the selected image file to {0} has failed, changes will now be reverted", destinationFileNameFullPath)); + UpdateIconAttributes(selectedSearchSource, fullPathToOriginalImage); #endif } } @@ -61,7 +60,7 @@ namespace Flow.Launcher.Plugin.WebSearch internal async ValueTask LoadPreviewIconAsync(string pathToPreviewIconImage) { - return await ImageLoader.LoadAsync(pathToPreviewIconImage); + return await Main._context.API.LoadImageAsync(pathToPreviewIconImage); } } }