| | |
| | | /// <summary>
|
| | | /// 验证码控件
|
| | | /// </summary>
|
| | | public class VerificationCodeControl : FrameLayout
|
| | | public class VerificationCodeControl : NormalFrameLayout
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | |
| | | // }
|
| | | //}
|
| | | txtCode.Parent.BorderColor = UserCenterColor.Current.TextFrameSelectColor;
|
| | | #if Android
|
| | | txtCode.SetSelectionEnd(); |
| | | #endif
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | if (textValue.Length == this.CodeLenth)
|
| | | {
|
| | | dicCodeControls[this.CodeLenth - 1].Foucs = true;
|
| | | #if Android
|
| | | //光标至于最后
|
| | | dicCodeControls[this.CodeLenth - 1].SetSelectionEnd();
|
| | | #endif
|
| | | for (int i = 0; i < this.CodeLenth; i++)
|
| | | {
|
| | | //先移除事件
|
| | |
| | | if (dicCodeControls.ContainsKey(index + 1) == true)
|
| | | {
|
| | | dicCodeControls[index + 1].Foucs = true;
|
| | | #if Android
|
| | | //光标至于最后
|
| | | dicCodeControls[index + 1].SetSelectionEnd();
|
| | | #endif
|
| | | }
|
| | | else
|
| | | {
|
| | | #if Android
|
| | | //光标至于最后
|
| | | txtCode.SetSelectionEnd();
|
| | | #endif
|
| | | //最后一位输入完成,校验验证码
|
| | | string code = string.Empty;
|
| | | for (int i = 0; i < this.CodeLenth; i++)
|
| | |
| | | if (dicCodeControls.ContainsKey(index - 1) == true)
|
| | | {
|
| | | dicCodeControls[index - 1].Foucs = true;
|
| | | #if Android
|
| | | //光标至于最后
|
| | | dicCodeControls[index - 1].SetSelectionEnd();
|
| | | #endif
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 清空输入的值
|
| | | /// </summary>
|
| | | public void ClearInputValue()
|
| | | {
|
| | | foreach (var inputText in this.dicCodeControls.Values)
|
| | | {
|
| | | //先移除事件
|
| | | inputText.TextChangeEventHandler -= TxtCode_TextChangeEvent;
|
| | | //赋值
|
| | | inputText.Text = string.Empty;
|
| | | inputText.TextChangeEventHandler += TxtCode_TextChangeEvent;
|
| | | }
|
| | | dicCodeControls[0].Foucs = true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 控件摧毁___________________________
|