void MessageBoxDialogParent_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Escape) { this.Result = MessageBoxResult.Cancel; e.Handled = true; if (MapApplication.Current != null) { MapApplication.Current.HideWindow(this); } else { WindowManager.HideWindow(this); } } }
private void button_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; if (button != null) { if (button.Name == OK_BUTTON_NAME) { this.Result = MessageBoxResult.OK; } else if (button.Name == CANCEL_BUTTON_NAME) { this.Result = MessageBoxResult.Cancel; } } if (MapApplication.Current != null) { MapApplication.Current.HideWindow(this); } else { WindowManager.HideWindow(this); } }