/// /// <summary> Event handler. Called by CityTextBox for text changed events. </summary> /// /// <remarks> 2019-04-20. </remarks> /// /// <param name="sender"> Source of the event. </param> /// <param name="e"> Text changed event information. </param> /// private void CityTextBox_TextChanged(object sender, TextChangedEventArgs e) { bool isValid = true; isValid = PatientValidation.ValidateCity(cityTextBox.Text); if (!isValid && !String.IsNullOrEmpty(cityTextBox.Text)) { cityBool = false; cityError.Visibility = Visibility.Visible; } else { cityBool = true; cityError.Visibility = Visibility.Hidden; } }
/// <summary> Event handler. Called by CityTextBox for text changed events. /// Ensure valid city was entered </summary> /// /// <remarks> 2019-04-20. </remarks> /// /// <param name="sender"> Source of the event. </param> /// <param name="e"> Text changed event information. </param> private void CityTextBox_TextChanged(object sender, TextChangedEventArgs e) { SubmitError.Visibility = Visibility.Hidden; //Hide the error initally bool isValid = true; //Validate the city isValid = PatientValidation.ValidateCity(cityTextBox.Text); if (!isValid && !String.IsNullOrEmpty(cityTextBox.Text)) //City is not valid and the textbox is not empty { city = ""; //City is emoty and error is visible cityError.Visibility = Visibility.Visible; } else //City is valid. Set it to the textbox contents/. { city = cityTextBox.Text; cityError.Visibility = Visibility.Hidden; } }