protected void OnClosingWindow(ClosingWindowEventHandlerArgs args) { var handler = ClosingWindow; if (handler != null) { handler(this, args); } }
#pragma warning restore 618 private void CloseClick(object sender, RoutedEventArgs e) { var closingWindowEventHandlerArgs = new ClosingWindowEventHandlerArgs(); OnClosingWindow(closingWindowEventHandlerArgs); if (closingWindowEventHandlerArgs.Cancelled) { return; } if (null == this.ParentWindow) { return; } this.ParentWindow.Close(); }