protected void OnClosingWindow(ClosingWindowEventHandlerArgs args) { var handler = ClosingWindow; if (handler != null) { handler(this, args); } }
private void CloseClick(object sender, RoutedEventArgs e) { var closingWindowEventHandlerArgs = new ClosingWindowEventHandlerArgs(); OnClosingWindow(closingWindowEventHandlerArgs); if (closingWindowEventHandlerArgs.Cancelled) return; var parentWindow = GetParentWindow(); if (parentWindow != null) { parentWindow.Close(); } }
// Clean up our event handlers when either of the children forms close. private void ChildWindowClosing(object sender, ClosingWindowEventHandlerArgs args) { if (sender == this.secondaryForm) { this.secondaryForm.Closing -= this.ChildWindowClosing; this.secondaryForm.PropertyChanged -= this.LatestValueChanged; } else if (sender == this.thirdForm) { this.thirdForm.Closing -= this.ChildWindowClosing; this.thirdForm.PropertyChanged -= this.LatestValueChanged; } }
#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(); }
private void CloseClick(object sender, RoutedEventArgs e) { var closingWindowEventHandlerArgs = new ClosingWindowEventHandlerArgs(); OnClosingWindow(closingWindowEventHandlerArgs); if (closingWindowEventHandlerArgs.Cancelled) { return; } var parentWindow = GetParentWindow(); if (parentWindow != null) { parentWindow.Close(); } }
protected void OnClosingWindow(ClosingWindowEventHandlerArgs args) { var handler = ClosingWindow; if (handler != null) handler(this, args); }