From f76110856fdc1c104d3dc1c5a888073b1ac3f413 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Wed, 2 Apr 2025 18:25:06 +0800 Subject: [PATCH] Use api function in main project --- Flow.Launcher/MessageBoxEx.xaml.cs | 2 +- Flow.Launcher/Msg.xaml.cs | 6 +++--- Flow.Launcher/ViewModel/MainViewModel.cs | 2 +- Flow.Launcher/ViewModel/PluginViewModel.cs | 2 +- Flow.Launcher/ViewModel/ResultViewModel.cs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Flow.Launcher/MessageBoxEx.xaml.cs b/Flow.Launcher/MessageBoxEx.xaml.cs index e9b434fd9..3d94769d0 100644 --- a/Flow.Launcher/MessageBoxEx.xaml.cs +++ b/Flow.Launcher/MessageBoxEx.xaml.cs @@ -156,7 +156,7 @@ namespace Flow.Launcher private async Task SetImageAsync(string imageName) { var imagePath = Path.Combine(Constant.ProgramDirectory, "Images", imageName); - var imageSource = await ImageLoader.LoadAsync(imagePath); + var imageSource = await App.API.LoadImageAsync(imagePath); Img.Source = imageSource; } diff --git a/Flow.Launcher/Msg.xaml.cs b/Flow.Launcher/Msg.xaml.cs index 94184ff63..ff9accd62 100644 --- a/Flow.Launcher/Msg.xaml.cs +++ b/Flow.Launcher/Msg.xaml.cs @@ -43,7 +43,7 @@ namespace Flow.Launcher private async System.Threading.Tasks.Task LoadImageAsync() { - imgClose.Source = await ImageLoader.LoadAsync(Path.Combine(Infrastructure.Constant.ProgramDirectory, "Images\\close.png")); + imgClose.Source = await App.API.LoadImageAsync(Path.Combine(Constant.ProgramDirectory, "Images\\close.png")); } void imgClose_MouseUp(object sender, MouseButtonEventArgs e) @@ -71,11 +71,11 @@ namespace Flow.Launcher if (!File.Exists(iconPath)) { - imgIco.Source = await ImageLoader.LoadAsync(Path.Combine(Constant.ProgramDirectory, "Images\\app.png")); + imgIco.Source = await App.API.LoadImageAsync(Path.Combine(Constant.ProgramDirectory, "Images\\app.png")); } else { - imgIco.Source = await ImageLoader.LoadAsync(iconPath); + imgIco.Source = await App.API.LoadImageAsync(iconPath); } Show(); diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 17e4b55b7..bfa5bd504 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1168,7 +1168,7 @@ namespace Flow.Launcher.ViewModel else if (plugins.Count == 1) { PluginIconPath = plugins.Single().Metadata.IcoPath; - PluginIconSource = await ImageLoader.LoadAsync(PluginIconPath); + PluginIconSource = await App.API.LoadImageAsync(PluginIconPath); SearchIconVisibility = Visibility.Hidden; } else diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs index e91badb38..93a595de4 100644 --- a/Flow.Launcher/ViewModel/PluginViewModel.cs +++ b/Flow.Launcher/ViewModel/PluginViewModel.cs @@ -45,7 +45,7 @@ namespace Flow.Launcher.ViewModel private async Task LoadIconAsync() { - Image = await ImageLoader.LoadAsync(PluginPair.Metadata.IcoPath); + Image = await App.API.LoadImageAsync(PluginPair.Metadata.IcoPath); OnPropertyChanged(nameof(Image)); } diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index db124e078..9aab71a32 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -199,7 +199,7 @@ namespace Flow.Launcher.ViewModel } } - return await ImageLoader.LoadAsync(imagePath, loadFullImage).ConfigureAwait(false); + return await App.API.LoadImageAsync(imagePath, loadFullImage).ConfigureAwait(false); } private async Task LoadImageAsync()