Exemplo n.º 1
0
        ///
        /// <summary>   Event handler. Called by PCodeTextBox 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 PCodeTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            bool isValid = true;

            //Postal Code Validation
            isValid = PatientValidation.ValidatePostalCode(pCodeTextBox.Text);

            if (!isValid && !String.IsNullOrWhiteSpace(pCodeTextBox.Text)) //String is not valid and not empty.
            {
                pCodeBool             = false;
                pCodeError.Visibility = Visibility.Visible;
            }
            else //Valid
            {
                pCodeBool             = true;
                pCodeError.Visibility = Visibility.Hidden;
            }
        }
Exemplo n.º 2
0
        /// <summary>   Event handler. Called by PCodeTextBox for text changed events.
        ///             Ensures valid postal code entry</summary>
        ///
        /// <remarks>   UNIT ONE, 2019-04-20. </remarks>
        ///
        /// <param name="sender">   Source of the event. </param>
        /// <param name="e">        Text changed event information. </param>

        private void PCodeTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            SubmitError.Visibility = Visibility.Hidden; //Hide the error initally
            bool isValid = true;

            //Check postal code validation
            isValid = PatientValidation.ValidatePostalCode(pCodeTextBox.Text);

            if (!isValid && !String.IsNullOrWhiteSpace(pCodeTextBox.Text)) //If not valid and not null
            {
                postalCode            = "";                                //Postal code equals nothing, error is present
                pCodeError.Visibility = Visibility.Visible;
            }
            else //Postal code is valid. And error is not visible.
            {
                postalCode            = pCodeTextBox.Text;
                pCodeError.Visibility = Visibility.Hidden;
            }
        }