Skip to content

Commit 5d8f277

Browse files
committed
Use image loader to load image
1 parent 534a111 commit 5d8f277

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Flow.Launcher.Core/MessageBoxEx.xaml.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
using System;
2+
using System.IO;
23
using System.Windows;
34
using System.Windows.Input;
4-
using System.Windows.Media.Imaging;
55
using Flow.Launcher.Infrastructure;
6+
using Flow.Launcher.Infrastructure.Image;
67
using Flow.Launcher.Infrastructure.Logger;
78

89
namespace Flow.Launcher.Core
@@ -142,7 +143,7 @@ private static void SetButtonVisibilityFocusAndResult(MessageBoxButton button, M
142143
}
143144
}
144145

145-
private static void SetImageOfMessageBox(MessageBoxImage icon)
146+
private static async void SetImageOfMessageBox(MessageBoxImage icon)
146147
{
147148
switch (icon)
148149
{
@@ -168,11 +169,11 @@ private static void SetImageOfMessageBox(MessageBoxImage icon)
168169
}
169170
}
170171

171-
private void SetImage(string imageName)
172+
private async void SetImage(string imageName)
172173
{
173-
string uri = Constant.ProgramDirectory + "/Images/" + imageName;
174-
var uriSource = new Uri(uri, UriKind.RelativeOrAbsolute);
175-
Img.Source = new BitmapImage(uriSource);
174+
var imagePath = Path.Combine(Constant.ProgramDirectory, "Images", imageName);
175+
var imageSource = await ImageLoader.LoadAsync(imagePath);
176+
Img.Source = imageSource;
176177
}
177178

178179
private void KeyEsc_OnPress(object sender, ExecutedRoutedEventArgs e)

0 commit comments

Comments
 (0)