ValidateLabels() public static method

Assure two labels are not same
public static ValidateLabels ( Control label1Ctrl, Control label2Ctrl ) : bool
label1Ctrl System.Windows.Forms.Control Control contains label information
label2Ctrl System.Windows.Forms.Control Control contains label information
return bool
Esempio n. 1
0
        /// <summary>
        /// Check if input are validated
        /// </summary>
        /// <returns>Whether input is validated</returns>
        private bool ValidateValues()
        {
            if (!Validation.ValidateNumbers(textBoxArcNumber, textBoxLineNumber))
            {
                return(false);
            }

            if (!Validation.ValidateCoord(textBoxXCoord) || !Validation.ValidateCoord(textBoxYCoord))
            {
                return(false);
            }

            if (Convert.ToUInt32(textBoxArcNumber.Text) != 0)
            {
                if (!Validation.ValidateLength(textBoxArcSpacing, "Spacing", false) ||
                    !Validation.ValidateLength(textBoxArcFirstRadius, "Radius", false) ||
                    !Validation.ValidateLabel(textBoxArcFirstLabel, m_data.LabelsList))
                {
                    return(false);
                }
            }

            if (Convert.ToUInt32(textBoxLineNumber.Text) != 0)
            {
                if (!Validation.ValidateLength(textBoxLineFirstDistance, "Distance", true) ||
                    !Validation.ValidateLabel(textBoxLineFirstLabel, m_data.LabelsList))
                {
                    return(false);
                }
            }

            if (Convert.ToUInt32(textBoxArcNumber.Text) != 0 && Convert.ToUInt32(textBoxLineNumber.Text) != 0)
            {
                if (!Validation.ValidateLabels(textBoxArcFirstLabel, textBoxLineFirstLabel))
                {
                    return(false);
                }
            }

            if (radioButtonCustomize.Checked)
            {
                if (!Validation.ValidateDegrees(textBoxStartDegree, textBoxEndDegree))
                {
                    return(false);
                }
            }

            return(true);
        }
        /// <summary>
        /// Check if input are validated
        /// </summary>
        /// <returns>Whether input is validated</returns>
        private bool ValidateValues()
        {
            if (!Validation.ValidateNumbers(textBoxXNumber, textBoxYNumber))
            {
                return(false);
            }

            if (!Validation.ValidateCoord(textBoxXCoord) || !Validation.ValidateCoord(textBoxYCoord))
            {
                return(false);
            }

            if (Convert.ToUInt32(textBoxXNumber.Text) != 0)
            {
                if (!Validation.ValidateLength(textBoxXSpacing, "Spacing", false) ||
                    !Validation.ValidateLabel(textBoxXFirstLabel, m_data.LabelsList))
                {
                    return(false);
                }
            }

            if (Convert.ToUInt32(textBoxYNumber.Text) != 0)
            {
                if (!Validation.ValidateLength(textBoxYSpacing, "Spacing", false) ||
                    !Validation.ValidateLabel(textBoxYFirstLabel, m_data.LabelsList))
                {
                    return(false);
                }
            }

            if (Convert.ToUInt32(textBoxXNumber.Text) != 0 && Convert.ToUInt32(textBoxYNumber.Text) != 0)
            {
                if (!Validation.ValidateLabels(textBoxXFirstLabel, textBoxYFirstLabel))
                {
                    return(false);
                }
            }

            return(true);
        }