forked from Kinnara/ModernWpf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContentDialogTestWindow.xaml.cs
43 lines (40 loc) · 1.19 KB
/
ContentDialogTestWindow.xaml.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
43
using ModernWpf.Controls;
using SamplesCommon;
using System;
using System.Windows;
namespace ModernWpf.SampleApp.ControlPages
{
public partial class ContentDialogTestWindow : Window
{
public ContentDialogTestWindow()
{
InitializeComponent();
}
private void ShowDialogInThisWindow(object sender, RoutedEventArgs e)
{
_ = new TestContentDialog().ShowAsync();
}
private void ShowDialogInMainWindow(object sender, RoutedEventArgs e)
{
DispatcherHelper.RunOnMainThread(async () =>
{
try
{
await new TestContentDialog() { Owner = Application.Current.MainWindow }.ShowAsync();
}
catch (Exception ex)
{
this.RunOnUIThread(() =>
{
_ = new ContentDialog
{
Owner = this,
Content = ex.Message,
CloseButtonText = "Close"
}.ShowAsync();
});
}
});
}
}
}