黄学彪
2020-02-21 bd46c57c77c276014db3192a4e2cc96e23c93202
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/VerificationCodeControl.cs
@@ -20,9 +20,13 @@
        /// </summary>
        public Action<string> FinishInputEvent = null;
        /// <summary>
        /// 密码输入类型
        /// 密码输入类型(它与NumberInputOnly不共存)
        /// </summary>
        public bool SecureTextEntry = false;
        /// <summary>
        /// 输入键盘指定为数字键盘(默认为true,它与SecureTextEntry不共存)
        /// </summary>
        public bool NumberInputOnly = true;
        /// <summary>
        /// 验证码长度
        /// </summary>
@@ -64,7 +68,7 @@
                frameCode.X = i * Application.GetRealWidth(115 + 49);
                frameCode.Width = Application.GetRealWidth(115);
                frameCode.Height = Application.GetRealHeight(104);
                frameCode.Radius = (uint)Application.GetMinRealAverage(6);
                frameCode.Radius = (uint)Application.GetRealHeight(17);
                frameCode.BorderWidth = 1;
                frameCode.BorderColor = UserCenterColor.Current.TextFrameColor;
                this.AddChidren(frameCode);
@@ -73,6 +77,10 @@
                if (SecureTextEntry == true)
                {
                    txtCode.SecureTextEntry = true;
                }
                else if (NumberInputOnly == true)
                {
                    txtCode.IsNumberKeyboardType = true;
                }
                txtCode.Name = i.ToString();
                txtCode.TextAlignment = TextAlignment.Center;
@@ -84,6 +92,8 @@
                txtCode.FoucsChanged += this.TxtCode_FoucsChangedEvent;
                //值改变事件
                txtCode.TextChangeEventHandler += this.TxtCode_TextChangeEvent;
                //键盘事件
                txtCode.KeyEventAction += this.TxtCode_KeyEvent;
            }
        }
@@ -172,6 +182,26 @@
            }
        }
        /// <summary>
        /// 键盘事件
        /// </summary>
        /// <param name="keysCode"></param>
        private void TxtCode_KeyEvent(object sender, string keysCode)
        {
            if (keysCode == "Del")
            {
                var txtCode = (TextInputControl)sender;
                if (txtCode.Text == string.Empty)
                {
                    int index = Convert.ToInt32(txtCode.Name);
                    if (dicCodeControls.ContainsKey(index - 1) == true)
                    {
                        dicCodeControls[index - 1].Foucs = true;
                    }
                }
            }
        }
        #endregion
        #region ■ 一般方法___________________________