/// <summary> /// Validates the PDC Acronym text box before continuing to the next page. /// </summary> private void PDCNameInput_OK(object sender, RoutedEventArgs e) { ReadOnlyObservableCollection <ValidationError> errors; IEnumerable <string> errorMessages; string errorMessage; if (System.Windows.Controls.Validation.GetHasError(PdcAcronymTextBox)) { errors = System.Windows.Controls.Validation.GetErrors(PdcAcronymTextBox); errorMessages = errors.Select(error => error.ErrorContent).OfType <string>(); errorMessage = string.Join(Environment.NewLine, errorMessages); MessageBox.Show(errorMessage, "PDC Acronym Error", MessageBoxButton.OK, MessageBoxImage.Error); PdcAcronymTextBox.Focus(); } else { TraverseDecisionTree("HistorianInput"); } }
private void ExpanderStep3_Expanded(object sender, RoutedEventArgs e) { if (System.Windows.Controls.Validation.GetHasError(PdcAcronymTextBox)) { ReadOnlyObservableCollection <ValidationError> errors = System.Windows.Controls.Validation.GetErrors(PdcAcronymTextBox); IEnumerable <string> errorMessages = errors.Select(error => error.ErrorContent).OfType <string>(); string errorMessage = string.Join(Environment.NewLine, errorMessages); MessageBox.Show(errorMessage, "PDC Acronym Error", MessageBoxButton.OK, MessageBoxImage.Error); m_dataContext.StepThreeExpanded = false; m_dataContext.StepTwoExpanded = true; PdcAcronymTextBox.Focus(); } else { m_dataContext.StepOneExpanded = false; m_dataContext.StepTwoExpanded = false; ButtonNext.Content = "Finish"; ButtonPrevious.IsEnabled = true; } }