private void OnClosing() { var e = new CancellableEventArgs(); Closing?.Invoke(this, e); if (!e.Cancelled) { _nativeWindow.Destroy(); CoreWindow cw; _coreWindows.TryRemove(_nativeWindow, out cw); } }