From 858e8a1a9d942cb339480430baa6c006b770898a Mon Sep 17 00:00:00 2001 From: wherewhere Date: Tue, 4 Jan 2022 22:28:54 +0800 Subject: [PATCH 1/5] It looks like ContentDialog now. --- ModernWpf.MessageBox.Test/App.xaml | 13 +- .../ModernWpf.MessageBox.Test.csproj | 2 +- ModernWpf.MessageBox/MessageBox.cs | 6 +- ModernWpf.MessageBox/MessageBoxWindow.xaml | 174 +++++++++++++++--- ModernWpf.MessageBox/MessageBoxWindow.xaml.cs | 3 +- .../ModernWpf.MessageBox.csproj | 2 +- 6 files changed, 163 insertions(+), 37 deletions(-) diff --git a/ModernWpf.MessageBox.Test/App.xaml b/ModernWpf.MessageBox.Test/App.xaml index adda155..2dc6bef 100644 --- a/ModernWpf.MessageBox.Test/App.xaml +++ b/ModernWpf.MessageBox.Test/App.xaml @@ -1,9 +1,10 @@ - + diff --git a/ModernWpf.MessageBox.Test/ModernWpf.MessageBox.Test.csproj b/ModernWpf.MessageBox.Test/ModernWpf.MessageBox.Test.csproj index a3f7361..4f417b6 100644 --- a/ModernWpf.MessageBox.Test/ModernWpf.MessageBox.Test.csproj +++ b/ModernWpf.MessageBox.Test/ModernWpf.MessageBox.Test.csproj @@ -2,7 +2,7 @@ WinExe - net45;net462;netcoreapp3.0;net5.0-windows10.0.18362 + net452;net462;netcoreapp3.0;net5.0-windows10.0.18362 True diff --git a/ModernWpf.MessageBox/MessageBox.cs b/ModernWpf.MessageBox/MessageBox.cs index 49b45cd..a08ca31 100644 --- a/ModernWpf.MessageBox/MessageBox.cs +++ b/ModernWpf.MessageBox/MessageBox.cs @@ -66,7 +66,7 @@ public static MessageBoxResult Show(Window? owner, bool lookForOwner, string mes public static MessageBoxResult? Show(Window? owner, bool lookForOwner, string messageBoxText, string? caption, MessageBoxButton? button, string? glyph, MessageBoxResult? defaultResult) => ShowInternal(owner, lookForOwner, messageBoxText, caption, button, glyph, defaultResult); -#if !NET45 && !NET462 +#if !NET452 && !NET462 [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("defaultResult")] #endif private static MessageBoxResult? ShowInternal(Window? owner, bool lookForOwner, string messageBoxText, string? caption, MessageBoxButton? button, string? glyph, MessageBoxResult? defaultResult) { @@ -139,12 +139,12 @@ public static async Task ShowAsync(Window? owner, bool lookFor public static Task ShowAsync(Window? owner, bool lookForOwner, string messageBoxText, string? caption, MessageBoxButton? button, string? glyph, MessageBoxResult? defaultResult) => ShowAsyncInternal(owner, lookForOwner, messageBoxText, caption, button, glyph, defaultResult); -#if !NET45 && !NET462 +#if !NET452 && !NET462 [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("defaultResult")] #endif private static Task ShowAsyncInternal(Window? owner, bool lookForOwner, string messageBoxText, string? caption, MessageBoxButton? button, string? glyph, MessageBoxResult? defaultResult) { var taskSource = new TaskCompletionSource( -#if !NET45 +#if !NET452 TaskCreationOptions.RunContinuationsAsynchronously #endif ); diff --git a/ModernWpf.MessageBox/MessageBoxWindow.xaml b/ModernWpf.MessageBox/MessageBoxWindow.xaml index 8564308..07e8669 100644 --- a/ModernWpf.MessageBox/MessageBoxWindow.xaml +++ b/ModernWpf.MessageBox/MessageBoxWindow.xaml @@ -1,26 +1,150 @@ - - - - - - - -