From 3e443b42891a816057a295c278990d59e64f47f0 Mon Sep 17 00:00:00 2001 From: Mark Gould Date: Thu, 4 Apr 2019 15:30:46 -0500 Subject: [PATCH] Fixes an issue where Window.Close is being called before Closing has finished, when CanCloseAsync executes too quickly. --- .../Platforms/net46/WindowManager.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Caliburn.Micro.Platform/Platforms/net46/WindowManager.cs b/src/Caliburn.Micro.Platform/Platforms/net46/WindowManager.cs index a95b90eb..82bd836c 100644 --- a/src/Caliburn.Micro.Platform/Platforms/net46/WindowManager.cs +++ b/src/Caliburn.Micro.Platform/Platforms/net46/WindowManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; @@ -417,9 +417,14 @@ private async void Closing(object sender, CancelEventArgs e) if (view.DialogResult != cachedDialogResult) { view.DialogResult = cachedDialogResult; + view.Close(); } + else + { + e.Cancel = false; + } + - view.Close(); } } }