Skip to content

Commit 5312505

Browse files
committed
Improve code quality
1 parent 5d8f277 commit 5312505

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Flow.Launcher.Core/MessageBoxEx.xaml.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.IO;
3+
using System.Threading.Tasks;
34
using System.Windows;
45
using System.Windows.Input;
56
using Flow.Launcher.Infrastructure;
@@ -67,7 +68,7 @@ public static MessageBoxResult Show(string messageBoxText, string caption, Messa
6768
msgBox.Title = caption;
6869
msgBox.TitleTextBlock.Text = caption;
6970
msgBox.DescTextBlock.Text = messageBoxText;
70-
SetImageOfMessageBox(icon);
71+
_ = SetImageOfMessageBoxAsync(icon);
7172
}
7273
SetButtonVisibilityFocusAndResult(button, defaultResult);
7374
msgBox.ShowDialog();
@@ -143,24 +144,24 @@ private static void SetButtonVisibilityFocusAndResult(MessageBoxButton button, M
143144
}
144145
}
145146

146-
private static async void SetImageOfMessageBox(MessageBoxImage icon)
147+
private static async Task SetImageOfMessageBoxAsync(MessageBoxImage icon)
147148
{
148149
switch (icon)
149150
{
150151
case MessageBoxImage.Exclamation:
151-
msgBox.SetImage("Exclamation.png");
152+
await msgBox.SetImageAsync("Exclamation.png");
152153
msgBox.Img.Visibility = Visibility.Visible;
153154
break;
154155
case MessageBoxImage.Question:
155-
msgBox.SetImage("Question.png");
156+
await msgBox.SetImageAsync("Question.png");
156157
msgBox.Img.Visibility = Visibility.Visible;
157158
break;
158159
case MessageBoxImage.Information:
159-
msgBox.SetImage("Information.png");
160+
await msgBox.SetImageAsync("Information.png");
160161
msgBox.Img.Visibility = Visibility.Visible;
161162
break;
162163
case MessageBoxImage.Error:
163-
msgBox.SetImage("Error.png");
164+
await msgBox.SetImageAsync("Error.png");
164165
msgBox.Img.Visibility = Visibility.Visible;
165166
break;
166167
default:
@@ -169,7 +170,7 @@ private static async void SetImageOfMessageBox(MessageBoxImage icon)
169170
}
170171
}
171172

172-
private async void SetImage(string imageName)
173+
private async Task SetImageAsync(string imageName)
173174
{
174175
var imagePath = Path.Combine(Constant.ProgramDirectory, "Images", imageName);
175176
var imageSource = await ImageLoader.LoadAsync(imagePath);

0 commit comments

Comments
 (0)