private static async Task PerformClosingOperationsAsync(Window window) { _isClosingConfirmed = await ExecuteClosingAsync(watcher => watcher.PrepareClosingAsync()).ConfigureAwait(false); if (!_isClosingConfirmed) { return; } _isClosingConfirmed = await ExecuteClosingAsync(watcher => watcher.ClosingAsync()).ConfigureAwait(false); if (_isClosingConfirmed) { await DispatcherService.InvokeAsync(window.Close).ConfigureAwait(false); } else { NotifyClosingCanceled(); } }
private static async Task CloseWindow(Window window) { IsClosingConfirmed = true; await DispatcherService.InvokeAsync(window.Close).ConfigureAwait(false); }