/// /// <summary> Event handler. Called by AddressTextBox 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 AddressTextBox_TextChanged(object sender, TextChangedEventArgs e) { bool isValid = true; //Ensure valid address isValid = PatientValidation.ValidateAddressLine1(addressTextBox.Text); if (!isValid && !String.IsNullOrEmpty(addressTextBox.Text)) //Not valid and not empty { addressBool = false; addressError.Visibility = Visibility.Visible; } else //valid { addressBool = true; addressError.Visibility = Visibility.Hidden; } }
/// <summary> Event handler. Called by AddressTextBox for text changed events. /// Ensure a vlaid address, otherwise set it to blank</summary> /// /// <remarks> 2019-04-20. </remarks> /// /// <param name="sender"> Source of the event. </param> /// <param name="e"> Text changed event information. </param> private void AddressTextBox_TextChanged(object sender, TextChangedEventArgs e) { SubmitError.Visibility = Visibility.Hidden; //Hide the error initally bool isValid = true; //Validate address isValid = PatientValidation.ValidateAddressLine1(addressTextBox.Text); if (!isValid && !String.IsNullOrEmpty(addressTextBox.Text)) //If it is not valid and not empty { addressOne = ""; //Address is not set. Error is shown addressError.Visibility = Visibility.Visible; } else //Valid address. Set the address to the textbox string { addressOne = addressTextBox.Text; addressError.Visibility = Visibility.Hidden; } }