-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtils.cs
42 lines (40 loc) · 1.36 KB
/
Utils.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using BG3LocalizationMerger.Resources.Strings;
using ModernWpf.Controls;
using System.Threading.Tasks;
using System.Windows;
namespace BG3LocalizationMerger
{
internal static class Utils
{
public static async Task ShowErrorMessage(Window owner, string text, string? title = null)
{
await owner.Dispatcher.Invoke(() =>
{
ContentDialog dialog =
new()
{
Title = title ?? Strings.Error,
Content = text,
IsPrimaryButtonEnabled = true,
PrimaryButtonText = Strings.OKButton
};
return dialog.ShowAsync();
});
}
public static Task<bool> ShowYesNoMessage(Window owner, string text, string? title = null)
{
return owner.Dispatcher.Invoke(async () =>
{
ContentDialog dialog =
new()
{
Title = title ?? Strings.Confirmation,
Content = text,
PrimaryButtonText = Strings.YesButton,
CloseButtonText = Strings.NoButton,
};
return await dialog.ShowAsync() == ContentDialogResult.Primary;
});
}
}
}