⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 passwordstrengthextenderextender.cs

📁 AJAX 应用 实现页面的无刷新
💻 CS
📖 第 1 页 / 共 2 页
字号:
        public string PrefixText
        {
            get
            {
                return GetPropertyValue(_prefixText, _prefixTextDefault);
            }
            set
            {
                SetPropertyValue(_prefixText, value);
            }
        }

        [DefaultValue(DisplayPosition.RightSide)]
        [ExtenderControlProperty()]
        public DisplayPosition DisplayPosition
        {
            get
            {
                return GetPropertyValue(_displayPosition, DisplayPosition.RightSide);
            }
            set
            {
                SetPropertyValue(_displayPosition, value);
            }
        }


        /// <summary>
        /// A property that is either Bar (as in progress bar indicating password strength) or
        /// text (i.e. low, medium, high, excellent for strength).
        /// </summary>
        [DefaultValue(StrengthIndicatorTypes.Text)]
        [ExtenderControlProperty()]
        public StrengthIndicatorTypes StrengthIndicatorType
        {
            get
            {
                return GetPropertyValue(_strengthIndicatorType, StrengthIndicatorTypes.Text);
            }
            set
            {
                SetPropertyValue(_strengthIndicatorType, value);
            }
        }

        /// <summary>
        /// The Calculation ratios or "weightings" used when calculating a passwords strength.
        /// Must be a string with 4 elements separated by a semi colon.
        /// Default is '50;15;15;20' which represents
        /// ... Password Length: 50%
        /// ... Meets Numerics requirements : 15%
        /// ... Meets Casing requirements: 15%
        /// ... Meets Symbol character requirements: 20%
        /// </summary>
        /// <remarks>Total of 4 elements must equal 100</remarks>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", Justification = "Assembly is not localized")]
        [DefaultValue("")]
        [ExtenderControlProperty()]
        public string CalculationWeightings
        {
            get
            {
                return GetPropertyValue(_calcWeightings, "");
            }
            set
            {
                
                if (String.IsNullOrEmpty(value))
                {
                    SetPropertyValue(_calcWeightings, value);
                }
                else
                {
                    int total = 0;
                    if (null != value)
                    {
                        string[] tmpList = value.Split(';');
                        foreach (string val in tmpList)
                        {
                            int tmpVal;

                            if (int.TryParse(val, NumberStyles.Integer, CultureInfo.InvariantCulture, out tmpVal))
                                total += tmpVal;
                        }
                    }


                    if (total == 100)
                        SetPropertyValue(_calcWeightings, value);
                    else
                        throw new ArgumentException("There must be 4 Calculation Weighting items which must total 100");

                }

            }
        }

        /// <summary>
        /// A semi-colon delimited string that specifies the string descriptions for the password strength when using a textual display.
        /// </summary>
        /// <example>None;Weak;Medium;Strong;Excellent</example>
        [ExtenderControlProperty()]
        [DefaultValue("")]
        public string TextStrengthDescriptions
        {
            get
            {
                return GetPropertyValue(_txtDisplayIndicators, "");
            }
            set
            {
                bool valid = false;
                if (!string.IsNullOrEmpty(value))
                {
                    string[] txtItems = value.Split(TXT_INDICATOR_DELIMITER);
                    if (txtItems.Length >= TXT_INDICATORS_MIN_COUNT && txtItems.Length <= TXT_INDICATORS_MAX_COUNT)
                    {
                        valid = true;
                    }
                }


                if (valid)
                {
                    SetPropertyValue(_txtDisplayIndicators, value);
                }
                else
                {
                    string msg = string.Format(CultureInfo.CurrentCulture, "Invalid property specification for TextStrengthDescriptions property. Must be a string delimited with '{0}', contain a minimum of {1} entries, and a maximum of {2}.", TXT_INDICATOR_DELIMITER, TXT_INDICATORS_MIN_COUNT, TXT_INDICATORS_MAX_COUNT);
                    throw new ArgumentException(msg);
                }
            }
        }

        /// <summary>
        /// A semi-colon delimited string that specifies the styles applicable to each
        /// string descriptions for the password strength when using a textual display.
        /// </summary>
        [ExtenderControlProperty()]
        [DefaultValue("")]
        public string StrengthStyles
        {
            get
            {
                return GetPropertyValue(_strengthStyles, "");
            }
            set
            {
                bool valid = false;
                if (!string.IsNullOrEmpty(value))
                {
                    string[] styleItems = value.Split(TXT_INDICATOR_DELIMITER);

                        if (styleItems.Length <= TXT_INDICATORS_MAX_COUNT)
                        {
                            valid = true;
                        }
                }


                if (valid)
                {
                    SetPropertyValue(_strengthStyles, value);
                }
                else
                {
                    string msg = string.Format(CultureInfo.CurrentCulture, "Invalid property specification for TextStrengthDescriptionStyles property. Must match the number of entries for the TextStrengthDescriptions property.");
                    throw new ArgumentException(msg);
                }
            }
        }

        /// <summary>
        /// If the <see cref="RequiresUpperAndLowerCaseCharacters"/> property is true, then this property determines the
        /// minimum lower case characters that are required. The default value is 0 which means this property is not
        /// in effect and there is no minimum limit.
        /// </summary>
        [ExtenderControlProperty()]
        [DefaultValue(0)]
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "LowerCase", Justification = "Avoiding a breaking change")]
        public int MinimumLowerCaseCharacters
        {
            get
            {
                return GetPropertyValue(_minLowerCaseChars, 0);
            }
            set
            {
                SetPropertyValue(_minLowerCaseChars,value);
            }
        }

        /// <summary>
        /// If the <see cref="RequiresUpperAndLowerCaseCharacters"/> property is true, then this property determines the
        /// minimum upper case characters that are required. The default value is 0 which means this property is not
        /// in effect and there is no minimum limit.
        /// </summary>
        [ExtenderControlProperty()]
        [DefaultValue(0)]
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "UpperCase", Justification = "Avoiding a breaking change")]
        public int MinimumUpperCaseCharacters
        {
            get
            {
                return GetPropertyValue(_minUpperCaseChars, 0);
            }
            set
            {
                SetPropertyValue(_minUpperCaseChars,value);
            }
        }

        /// <summary>
        /// A semi-colon delimited string that specifies the styles applicable to each
        /// string descriptions for the password strength when using a textual display.
        /// </summary>
        /// <remarks>THis property has been deprecated. Please use the <see cref="StrengthStyles"/> property instead.</remarks>
        [ExtenderControlProperty(),Obsolete("This property has been deprecated. Please use the StrengthStyles property instead.")]
        [DefaultValue("")]
        public string TextStrengthDescriptionStyles
        {
            get
            {
                return StrengthStyles;
            }
            set
            {
            	StrengthStyles = value;
            }
        }


    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -