| | |
| | | using System;
|
| | | using Shared.Common;
|
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | |
|
| | |
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 标记是否能够校验验证码了
|
| | | /// 1:手机号 2:邮箱
|
| | | /// </summary>
|
| | | private bool canCheckCode = false;
|
| | | private int SelectIndex = 1;
|
| | | /// <summary>
|
| | | /// 手机或者邮箱
|
| | | /// 当前的输入控件 0:手机号或者邮箱 1:验证码 2:第一次密码 3:第二次密码 |
| | | /// </summary>
|
| | | private string strPhoneEmail = string.Empty;
|
| | | private List<TextInputControl> ListNowInputControl = new List<TextInputControl> { null, null, null };
|
| | | /// <summary>
|
| | | /// 错误信息控件
|
| | | /// 错误提示控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnMsgControl = null;
|
| | | private NormalViewControl btnErrorMsg = null;
|
| | | /// <summary>
|
| | | /// 重置按钮
|
| | | /// </summary>
|
| | | private BottomClickButton btnReset = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// 界面显示
|
| | | /// </summary>
|
| | | public void ShowForm()
|
| | | {
|
| | | //设置头部信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.ForgotPassword));
|
| | |
|
| | | //初始化中部信息
|
| | | this.InitMiddleFrame();
|
| | | //重置按钮
|
| | | this.btnReset = new BottomClickButton(688);
|
| | | btnReset.Y = Application.GetRealHeight(1290);
|
| | | btnReset.TextID = R.MyInternationalizationString.ComfirmReset;
|
| | | btnReset.oldBackgroundColor = UserCenterColor.Current.ClickButtonDefultColor;
|
| | | bodyFrameLayout.AddChidren(btnReset);
|
| | | btnReset.CanClick = false;
|
| | | btnReset.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //注册用户
|
| | | this.ResetPassword();
|
| | | };
|
| | |
|
| | | //几个输入控件的集合
|
| | | var listControl = new List<TextInputControl>();
|
| | | //初始化手机号输入控件
|
| | | var framePhone = this.InitPhoneInputView(ref listControl);
|
| | | //初始化邮箱输入控件
|
| | | var frameEmail = this.InitEmailInputView(ref listControl);
|
| | |
|
| | | //错误提示Btn
|
| | | this.btnErrorMsg = new NormalViewControl(700, 58, true);
|
| | | btnErrorMsg.X = Application.GetRealWidth(127);
|
| | | btnErrorMsg.Y = Application.GetRealHeight(1060);
|
| | | btnErrorMsg.TextColor = Common.ZigbeeColor.Current.GXCTextRed;
|
| | | btnErrorMsg.IsBold = true;
|
| | | bodyFrameLayout.AddChidren(btnErrorMsg);
|
| | |
|
| | | //邮箱,手机号的切换控件
|
| | | var sitchControl = new Login.Controls.PhoneEmailSelectControl();
|
| | | sitchControl.Y = Application.GetRealHeight(127);
|
| | | bodyFrameLayout.AddChidren(sitchControl);
|
| | |
|
| | | sitchControl.SelectMenuEvent += (selectMenu) =>
|
| | | {
|
| | | this.SelectIndex = selectMenu;
|
| | | //手机号
|
| | | if (this.SelectIndex == 1)
|
| | | {
|
| | | framePhone.Visible = true;
|
| | | frameEmail.Visible = false;
|
| | | //当前的输入控件
|
| | | ListNowInputControl[0] = listControl[0];
|
| | | ListNowInputControl[1] = listControl[1];
|
| | | ListNowInputControl[2] = listControl[2];
|
| | | }
|
| | | //邮箱
|
| | | else if (this.SelectIndex == 2)
|
| | | {
|
| | | framePhone.Visible = false;
|
| | | frameEmail.Visible = true;
|
| | | //当前的输入控件
|
| | | ListNowInputControl[0] = listControl[3];
|
| | | ListNowInputControl[1] = listControl[4];
|
| | | ListNowInputControl[2] = listControl[5];
|
| | | }
|
| | | //检测注册按钮的状态
|
| | | this.CheckResetButtonStatu();
|
| | | };
|
| | | //执行初始化
|
| | | sitchControl.InitControl(ZigbeeColor.Current.GXCButtonBlackSelectedColor, HdlUserCenterResourse.UserInfo.UserPhone != string.Empty ? 1 : 2);
|
| | | //菜单限制
|
| | | sitchControl.PhoneEnable = HdlUserCenterResourse.UserInfo.UserPhone != string.Empty;
|
| | | sitchControl.EmailEnable = HdlUserCenterResourse.UserInfo.UserEmail != string.Empty;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化中部信息
|
| | | /// 初始化手机号输入的界面
|
| | | /// </summary>
|
| | | private void InitMiddleFrame()
|
| | | /// <param name="listControl">几个输入控件的集合</param>
|
| | | /// <returns></returns>
|
| | | private FrameLayout InitPhoneInputView(ref List<TextInputControl> listControl)
|
| | | {
|
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | //背景框
|
| | | var frameBack = new FrameLayout();
|
| | | frameBack.Height = Application.GetRealHeight(323);
|
| | | frameBack.BackgroundColor = UserCenterColor.Current.White;
|
| | | frameBack.Y = Application.GetRealHeight(334);
|
| | | frameBack.Height = Application.GetRealHeight(852);
|
| | | frameBack.Width = Application.GetRealWidth(942);
|
| | | frameBack.Gravity = Gravity.CenterHorizontal;
|
| | | frameBack.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
|
| | | frameBack.Radius = (uint)Application.GetRealHeight(17);
|
| | | bodyFrameLayout.AddChidren(frameBack);
|
| | |
|
| | | var rowPhone = new FrameRowControl();
|
| | | //右边偏移量->增加宽度
|
| | | rowPhone.RightOffset = -ControlCommonResourse.XXLeft;
|
| | | rowPhone.Y = Application.GetRealHeight(23);
|
| | | rowPhone.Width = this.GetPictrueRealSize(628);
|
| | | bodyFrameLayout.AddChidren(rowPhone);
|
| | | //请输入邮箱或手机号
|
| | | string phoneValue = string.IsNullOrEmpty(UserCenterResourse.UserInfo.Phone) == true ? string.Empty : "+" + UserCenterResourse.UserInfo.AreaCode + " " + UserCenterResourse.UserInfo.Phone;
|
| | | var txtPhone = rowPhone.AddLeftCaption(string.IsNullOrEmpty(phoneValue) == true ? UserCenterResourse.UserInfo.Email : phoneValue, 600);
|
| | | txtPhone.TextColor = UserCenterColor.Current.TextGrayColor2;
|
| | | //底线
|
| | | rowPhone.AddBottomLine();
|
| | | //当前选择的方式
|
| | | this.strPhoneEmail = txtPhone.Text;
|
| | | //手机号行的容器
|
| | | var framePhone = new FrameLayout();
|
| | | framePhone.X = Application.GetRealWidth(29);
|
| | | framePhone.Y = Application.GetRealHeight(29);
|
| | | framePhone.Width = Application.GetRealWidth(884);
|
| | | framePhone.Height = Application.GetRealHeight(138);
|
| | | frameBack.AddChidren(framePhone);
|
| | | //地区码
|
| | | var btnAreaCode = new NormalViewControl(160, 92, true);
|
| | | btnAreaCode.Gravity = Gravity.CenterVertical;
|
| | | btnAreaCode.TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
|
| | | btnAreaCode.Text = "+" + HdlUserCenterResourse.UserInfo.PhoneAreaCode;
|
| | | btnAreaCode.TextAlignment = TextAlignment.Center;
|
| | | framePhone.AddChidren(btnAreaCode);
|
| | | //手机号输入框
|
| | | var btnPhone = new NormalViewControl(600, 92, true);
|
| | | btnPhone.X = Application.GetRealWidth(222);
|
| | | btnPhone.Gravity = Gravity.CenterVertical;
|
| | | btnPhone.Text = HdlUserCenterResourse.UserInfo.UserPhone;
|
| | | btnPhone.TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
|
| | | framePhone.AddChidren(btnPhone);
|
| | | //手机号输入框的底线
|
| | | var btnPhoneLine = new NormalViewControl(framePhone.Width, HdlControlResourse.BottomLineHeight, false);
|
| | | btnPhoneLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | btnPhoneLine.Y = framePhone.Height - HdlControlResourse.BottomLineHeight;
|
| | | framePhone.AddChidren(btnPhoneLine);
|
| | |
|
| | | var rowCode = new FrameRowControl();
|
| | | rowCode.Y = rowPhone.Bottom + Application.GetRealHeight(20);
|
| | | rowCode.Width = this.GetPictrueRealSize(628);
|
| | | bodyFrameLayout.AddChidren(rowCode);
|
| | | //请输入验证码
|
| | | var txtCode = rowCode.AddLeftInput("", 600);
|
| | | txtCode.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputVerificationCode);
|
| | | txtCode.TextChangeEventHandler += this.txtCodeValueChangedEvent;
|
| | |
|
| | | //验证码的容器
|
| | | var frameCode = new FrameLayout();
|
| | | frameCode.X = Application.GetRealWidth(29);
|
| | | frameCode.Y = Application.GetRealHeight(196);
|
| | | frameCode.Width = framePhone.Width;
|
| | | frameCode.Height = framePhone.Height;
|
| | | frameBack.AddChidren(frameCode);
|
| | | //验证码输入框
|
| | | var txtCode = new TextInputControl(536, 92, true);
|
| | | txtCode.X = Application.GetRealWidth(29);
|
| | | txtCode.Gravity = Gravity.CenterVertical;
|
| | | txtCode.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputVerificationCode);
|
| | | txtCode.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
|
| | | frameCode.AddChidren(txtCode);
|
| | | listControl.Add(txtCode);
|
| | | //获取验证码
|
| | | var btnCode = new NormalViewControl(302, 127, true);
|
| | | btnCode.X = rowPhone.Right + Application.GetRealWidth(35);
|
| | | btnCode.Y = Application.GetRealHeight(23);
|
| | | btnCode.RadiusEx = 12;
|
| | | btnCode.TextID = R.MyInternationalizationString.uGetVerificationCode;
|
| | | btnCode.TextColor = UserCenterColor.Current.White;
|
| | | btnCode.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
|
| | | btnCode.TextAlignment = TextAlignment.Center;
|
| | | bodyFrameLayout.AddChidren(btnCode);
|
| | | btnCode.ButtonClickEvent += (sender, e) =>
|
| | | var btnSendCode = new NormalViewControl(300, 127, true);
|
| | | btnSendCode.X = frameCode.Width - Application.GetRealWidth(300);
|
| | | btnSendCode.Gravity = Gravity.CenterVertical;
|
| | | btnSendCode.TextID = R.MyInternationalizationString.SendVerificationCode;
|
| | | btnSendCode.TextColor = ZigbeeColor.Current.GXCTextWhiteColor;
|
| | | btnSendCode.TextAlignment = TextAlignment.Center;
|
| | | btnSendCode.BackgroundColor = 0xFFFC744B;
|
| | | btnSendCode.Radius = (uint)Application.GetRealHeight(12);
|
| | | btnSendCode.IsBold = true;
|
| | | frameCode.AddChidren(btnSendCode);
|
| | | btnSendCode.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //发送验证码
|
| | | this.SetVerificationCode(btnCode);
|
| | | this.SendVerificationCode(btnSendCode);
|
| | | };
|
| | | //获取验证码的底线
|
| | | var btnCodeLine = new NormalViewControl(Application.GetRealWidth(536), HdlControlResourse.BottomLineHeight, false);
|
| | | btnCodeLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | btnCodeLine.Y = frameCode.Height - HdlControlResourse.BottomLineHeight;
|
| | | frameCode.AddChidren(btnCodeLine);
|
| | | //联动底线
|
| | | txtCode.btnLine = btnCodeLine;
|
| | |
|
| | | //第一次密码的容器
|
| | | var framePswOne = new FrameLayout();
|
| | | framePswOne.X = Application.GetRealWidth(29);
|
| | | framePswOne.Y = Application.GetRealHeight(363);
|
| | | framePswOne.Width = framePhone.Width;
|
| | | framePswOne.Height = framePhone.Height;
|
| | | frameBack.AddChidren(framePswOne);
|
| | | //第一次密码的输入框
|
| | | var txtPswOne = new TextInputControl(700, 92, true);
|
| | | txtPswOne.X = Application.GetRealWidth(29);
|
| | | txtPswOne.Gravity = Gravity.CenterVertical;
|
| | | txtPswOne.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD);
|
| | | txtPswOne.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
|
| | | txtPswOne.SecureTextEntry = true;
|
| | | framePswOne.AddChidren(txtPswOne);
|
| | | listControl.Add(txtPswOne);
|
| | | //第一次密码可视图标
|
| | | var btnPswOneHiden = new IconViewControl(92);
|
| | | btnPswOneHiden.X = Application.GetRealWidth(775);
|
| | | btnPswOneHiden.Gravity = Gravity.CenterVertical;
|
| | | btnPswOneHiden.SelectedImagePath = "Account/HidePwd.png";
|
| | | btnPswOneHiden.UnSelectedImagePath = "Account/UnhidePwd.png";
|
| | | btnPswOneHiden.IsSelected = true;
|
| | | framePswOne.AddChidren(btnPswOneHiden);
|
| | | btnPswOneHiden.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | btnPswOneHiden.IsSelected = !btnPswOneHiden.IsSelected;
|
| | | txtPswOne.SecureTextEntry = btnPswOneHiden.IsSelected;
|
| | | };
|
| | | //第一次密码输入框的底线
|
| | | var btnPswOneLine = new NormalViewControl(framePswOne.Width, HdlControlResourse.BottomLineHeight, false);
|
| | | btnPswOneLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | btnPswOneLine.Y = framePswOne.Height - HdlControlResourse.BottomLineHeight;
|
| | | framePswOne.AddChidren(btnPswOneLine);
|
| | | //联动底线
|
| | | txtPswOne.btnLine = btnPswOneLine;
|
| | |
|
| | | //第二次密码的容器
|
| | | var framePswTwo = new FrameLayout();
|
| | | framePswTwo.X = Application.GetRealWidth(29);
|
| | | framePswTwo.Y = Application.GetRealHeight(530);
|
| | | framePswTwo.Width = framePhone.Width;
|
| | | framePswTwo.Height = framePhone.Height;
|
| | | frameBack.AddChidren(framePswTwo);
|
| | | //第二次密码的输入框
|
| | | var txtPswTwo = new TextInputControl(700, 92, true);
|
| | | txtPswTwo.X = Application.GetRealWidth(29);
|
| | | txtPswTwo.Gravity = Gravity.CenterVertical;
|
| | | txtPswTwo.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD);
|
| | | txtPswTwo.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
|
| | | txtPswTwo.SecureTextEntry = true;
|
| | | framePswTwo.AddChidren(txtPswTwo);
|
| | | listControl.Add(txtPswTwo);
|
| | | //第二次密码可视图标
|
| | | var btnPswTwoHiden = new IconViewControl(92);
|
| | | btnPswTwoHiden.X = Application.GetRealWidth(775);
|
| | | btnPswTwoHiden.Gravity = Gravity.CenterVertical;
|
| | | btnPswTwoHiden.SelectedImagePath = "Account/HidePwd.png";
|
| | | btnPswTwoHiden.UnSelectedImagePath = "Account/UnhidePwd.png";
|
| | | btnPswTwoHiden.IsSelected = true;
|
| | | framePswTwo.AddChidren(btnPswTwoHiden);
|
| | | btnPswTwoHiden.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | btnPswTwoHiden.IsSelected = !btnPswTwoHiden.IsSelected;
|
| | | txtPswTwo.SecureTextEntry = btnPswTwoHiden.IsSelected;
|
| | | };
|
| | | //第二次密码输入框的底线
|
| | | var btnPswTwoLine = new NormalViewControl(framePswTwo.Width, HdlControlResourse.BottomLineHeight, false);
|
| | | btnPswTwoLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | btnPswTwoLine.Y = framePswTwo.Height - HdlControlResourse.BottomLineHeight;
|
| | | framePswTwo.AddChidren(btnPswTwoLine);
|
| | | //联动底线
|
| | | txtPswTwo.btnLine = btnPswTwoLine;
|
| | |
|
| | | //验证码输入变更时
|
| | | txtCode.TextChangeEventHandler += (sender, value) =>
|
| | | {
|
| | | //检测注册按钮的状态
|
| | | this.CheckResetButtonStatu();
|
| | | };
|
| | | //密码输入变更时
|
| | | txtPswOne.TextChangeEventHandler += (sender, value) =>
|
| | | {
|
| | | //检测注册按钮的状态
|
| | | this.CheckResetButtonStatu();
|
| | | };
|
| | | txtPswTwo.TextChangeEventHandler += (sender, value) =>
|
| | | {
|
| | | //检测注册按钮的状态
|
| | | this.CheckResetButtonStatu();
|
| | | };
|
| | |
|
| | | //错误信息控件
|
| | | btnMsgControl = new NormalViewControl(800, 58, true);
|
| | | btnMsgControl.X = ControlCommonResourse.XXLeft;
|
| | | btnMsgControl.Y = rowCode.Bottom + Application.GetRealHeight(46);
|
| | | btnMsgControl.TextColor = 0xfff75858;
|
| | | btnMsgControl.TextID = R.MyInternationalizationString.uVerificationCodeErrorInputAgain;
|
| | | bodyFrameLayout.AddChidren(btnMsgControl);
|
| | | btnMsgControl.Visible = false;
|
| | | return frameBack;
|
| | | }
|
| | |
|
| | | if (string.IsNullOrEmpty(UserCenterResourse.UserInfo.Phone) == true
|
| | | || string.IsNullOrEmpty(UserCenterResourse.UserInfo.Email) == true)
|
| | | {
|
| | | rowPhone.UseClickStatu = false;
|
| | | return;
|
| | | }
|
| | | /// <summary>
|
| | | /// 初始化邮箱输入的界面
|
| | | /// </summary>
|
| | | /// <param name="listControl">几个输入控件的集合</param>
|
| | | /// <returns></returns>
|
| | | private FrameLayout InitEmailInputView(ref List<TextInputControl> listControl)
|
| | | {
|
| | | //背景框
|
| | | var frameBack = new FrameLayout();
|
| | | frameBack.Y = Application.GetRealHeight(334);
|
| | | frameBack.Height = Application.GetRealHeight(852);
|
| | | frameBack.Width = Application.GetRealWidth(942);
|
| | | frameBack.Gravity = Gravity.CenterHorizontal;
|
| | | frameBack.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
|
| | | frameBack.Radius = (uint)Application.GetRealHeight(17);
|
| | | bodyFrameLayout.AddChidren(frameBack);
|
| | |
|
| | | //显示可以切换邮箱->一个可以遮住Body的东西
|
| | | var frameTran = new FrameLayoutStatuControl();
|
| | | frameTran.UseClickStatu = false;
|
| | | frameTran.BackgroundColor = UserCenterColor.Current.Transparent;
|
| | | bodyFrameLayout.AddChidren(frameTran);
|
| | | frameTran.Visible = false;
|
| | | frameTran.ButtonClickEvent += (sender, e) =>
|
| | | //邮箱行的容器
|
| | | var frameEmail = new FrameLayout();
|
| | | frameEmail.X = Application.GetRealWidth(29);
|
| | | frameEmail.Y = Application.GetRealHeight(29);
|
| | | frameEmail.Width = Application.GetRealWidth(884);
|
| | | frameEmail.Height = Application.GetRealHeight(138);
|
| | | frameBack.AddChidren(frameEmail);
|
| | | //邮箱输入框
|
| | | var btnEmail = new NormalViewControl(700, 92, true);
|
| | | btnEmail.X = Application.GetRealWidth(29);
|
| | | btnEmail.Gravity = Gravity.CenterVertical;
|
| | | btnEmail.TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
|
| | | btnEmail.Text = HdlUserCenterResourse.UserInfo.UserEmail;
|
| | | frameEmail.AddChidren(btnEmail);
|
| | | //邮箱输入框的底线
|
| | | var btnEmailLine = new NormalViewControl(frameEmail.Width, HdlControlResourse.BottomLineHeight, false);
|
| | | btnEmailLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | btnEmailLine.Y = frameEmail.Height - HdlControlResourse.BottomLineHeight;
|
| | | frameEmail.AddChidren(btnEmailLine);
|
| | |
|
| | | //验证码的容器
|
| | | var frameCode = new FrameLayout();
|
| | | frameCode.X = Application.GetRealWidth(29);
|
| | | frameCode.Y = Application.GetRealHeight(196);
|
| | | frameCode.Width = frameEmail.Width;
|
| | | frameCode.Height = frameEmail.Height;
|
| | | frameBack.AddChidren(frameCode);
|
| | | //验证码输入框
|
| | | var txtCode = new TextInputControl(536, 92, true);
|
| | | txtCode.X = Application.GetRealWidth(29);
|
| | | txtCode.Gravity = Gravity.CenterVertical;
|
| | | txtCode.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputVerificationCode);
|
| | | txtCode.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
|
| | | frameCode.AddChidren(txtCode);
|
| | | listControl.Add(txtCode);
|
| | | //获取验证码
|
| | | var btnSendCode = new NormalViewControl(300, 127, true);
|
| | | btnSendCode.X = frameCode.Width - Application.GetRealWidth(300);
|
| | | btnSendCode.Gravity = Gravity.CenterVertical;
|
| | | btnSendCode.TextID = R.MyInternationalizationString.SendVerificationCode;
|
| | | btnSendCode.TextColor = ZigbeeColor.Current.GXCTextWhiteColor;
|
| | | btnSendCode.TextAlignment = TextAlignment.Center;
|
| | | btnSendCode.BackgroundColor = 0xFFFC744B;
|
| | | btnSendCode.Radius = (uint)Application.GetRealHeight(12);
|
| | | btnSendCode.IsBold = true;
|
| | | frameCode.AddChidren(btnSendCode);
|
| | | btnSendCode.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | frameTran.Visible = false;
|
| | | //发送验证码
|
| | | this.SendVerificationCode(btnSendCode);
|
| | | };
|
| | | var frameList = new FrameLayout();
|
| | | frameList.X = ControlCommonResourse.XXLeft - Application.GetRealWidth(17);
|
| | | frameList.Y = rowPhone.Bottom - ControlCommonResourse.BottomLineHeight - 1;
|
| | | frameList.Width = this.GetPictrueRealSize(628);
|
| | | frameList.Height = this.GetPictrueRealSize(176);
|
| | | frameTran.AddChidren(frameList);
|
| | | //动画用
|
| | | var frameAnimate = new FrameLayoutStatuControl();
|
| | | frameAnimate.UseClickStatu = false;
|
| | | frameList.AddChidren(frameAnimate);
|
| | | //获取验证码的底线
|
| | | var btnCodeLine = new NormalViewControl(Application.GetRealWidth(536), HdlControlResourse.BottomLineHeight, false);
|
| | | btnCodeLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | btnCodeLine.Y = frameCode.Height - HdlControlResourse.BottomLineHeight;
|
| | | frameCode.AddChidren(btnCodeLine);
|
| | | //联动底线
|
| | | txtCode.btnLine = btnCodeLine;
|
| | |
|
| | | var btnPic = new PicViewControl(frameList.Width, frameList.Height, false);
|
| | | btnPic.UnSelectedImagePath = "Item/ForgotPswList.png";
|
| | | frameAnimate.AddChidren(btnPic);
|
| | | var btnEmail = new NormalViewControl(450, 58, true);
|
| | | btnEmail.X = this.GetPictrueRealSize(46);
|
| | | btnEmail.Y = this.GetPictrueRealSize(32);
|
| | | btnEmail.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | btnEmail.Text = UserCenterResourse.UserInfo.Email;
|
| | | frameAnimate.AddChidren(btnEmail);
|
| | | frameAnimate.ButtonClickEvent += (sender, e) =>
|
| | | //第一次密码的容器
|
| | | var framePswOne = new FrameLayout();
|
| | | framePswOne.X = Application.GetRealWidth(29);
|
| | | framePswOne.Y = Application.GetRealHeight(363);
|
| | | framePswOne.Width = frameEmail.Width;
|
| | | framePswOne.Height = frameEmail.Height;
|
| | | frameBack.AddChidren(framePswOne);
|
| | | //第一次密码的输入框
|
| | | var txtPswOne = new TextInputControl(700, 92, true);
|
| | | txtPswOne.X = Application.GetRealWidth(29);
|
| | | txtPswOne.Gravity = Gravity.CenterVertical;
|
| | | txtPswOne.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD);
|
| | | txtPswOne.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
|
| | | txtPswOne.SecureTextEntry = true;
|
| | | framePswOne.AddChidren(txtPswOne);
|
| | | listControl.Add(txtPswOne);
|
| | | //第一次密码可视图标
|
| | | var btnPswOneHiden = new IconViewControl(92);
|
| | | btnPswOneHiden.X = Application.GetRealWidth(775);
|
| | | btnPswOneHiden.Gravity = Gravity.CenterVertical;
|
| | | btnPswOneHiden.SelectedImagePath = "Account/HidePwd.png";
|
| | | btnPswOneHiden.UnSelectedImagePath = "Account/UnhidePwd.png";
|
| | | btnPswOneHiden.IsSelected = true;
|
| | | framePswOne.AddChidren(btnPswOneHiden);
|
| | | btnPswOneHiden.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | frameTran.Visible = false;
|
| | | string oldValue = txtPhone.Text;
|
| | | txtPhone.Text = btnEmail.Text;
|
| | | btnEmail.Text = oldValue;
|
| | | btnPswOneHiden.IsSelected = !btnPswOneHiden.IsSelected;
|
| | | txtPswOne.SecureTextEntry = btnPswOneHiden.IsSelected;
|
| | | };
|
| | | //第一次密码输入框的底线
|
| | | var btnPswOneLine = new NormalViewControl(framePswOne.Width, HdlControlResourse.BottomLineHeight, false);
|
| | | btnPswOneLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | btnPswOneLine.Y = framePswOne.Height - HdlControlResourse.BottomLineHeight;
|
| | | framePswOne.AddChidren(btnPswOneLine);
|
| | | //联动底线
|
| | | txtPswOne.btnLine = btnPswOneLine;
|
| | |
|
| | | //当前选择的方式
|
| | | this.strPhoneEmail = txtPhone.Text;
|
| | | };
|
| | | rowPhone.ButtonClickEvent += (sender, e) =>
|
| | | //第二次密码的容器
|
| | | var framePswTwo = new FrameLayout();
|
| | | framePswTwo.X = Application.GetRealWidth(29);
|
| | | framePswTwo.Y = Application.GetRealHeight(530);
|
| | | framePswTwo.Width = frameEmail.Width;
|
| | | framePswTwo.Height = frameEmail.Height;
|
| | | frameBack.AddChidren(framePswTwo);
|
| | | //第二次密码的输入框
|
| | | var txtPswTwo = new TextInputControl(700, 92, true);
|
| | | txtPswTwo.X = Application.GetRealWidth(29);
|
| | | txtPswTwo.Gravity = Gravity.CenterVertical;
|
| | | txtPswTwo.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD);
|
| | | txtPswTwo.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
|
| | | txtPswTwo.SecureTextEntry = true;
|
| | | framePswTwo.AddChidren(txtPswTwo);
|
| | | listControl.Add(txtPswTwo);
|
| | | //第二次密码可视图标
|
| | | var btnPswTwoHiden = new IconViewControl(92);
|
| | | btnPswTwoHiden.X = Application.GetRealWidth(775);
|
| | | btnPswTwoHiden.Gravity = Gravity.CenterVertical;
|
| | | btnPswTwoHiden.SelectedImagePath = "Account/HidePwd.png";
|
| | | btnPswTwoHiden.UnSelectedImagePath = "Account/UnhidePwd.png";
|
| | | btnPswTwoHiden.IsSelected = true;
|
| | | framePswTwo.AddChidren(btnPswTwoHiden);
|
| | | btnPswTwoHiden.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (frameTran.Visible == false)
|
| | | {
|
| | | frameTran.Visible = true;
|
| | | }
|
| | | btnPswTwoHiden.IsSelected = !btnPswTwoHiden.IsSelected;
|
| | | txtPswTwo.SecureTextEntry = btnPswTwoHiden.IsSelected;
|
| | | };
|
| | | //第二次密码输入框的底线
|
| | | var btnPswTwoLine = new NormalViewControl(framePswTwo.Width, HdlControlResourse.BottomLineHeight, false);
|
| | | btnPswTwoLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | btnPswTwoLine.Y = framePswTwo.Height - HdlControlResourse.BottomLineHeight;
|
| | | framePswTwo.AddChidren(btnPswTwoLine);
|
| | | //联动底线
|
| | | txtPswTwo.btnLine = btnPswTwoLine;
|
| | |
|
| | | //验证码输入变更时
|
| | | txtCode.TextChangeEventHandler += (sender, value) =>
|
| | | {
|
| | | //检测注册按钮的状态
|
| | | this.CheckResetButtonStatu();
|
| | | };
|
| | | //密码输入变更时
|
| | | txtPswOne.TextChangeEventHandler += (sender, value) =>
|
| | | {
|
| | | //检测注册按钮的状态
|
| | | this.CheckResetButtonStatu();
|
| | | };
|
| | | txtPswTwo.TextChangeEventHandler += (sender, value) =>
|
| | | {
|
| | | //检测注册按钮的状态
|
| | | this.CheckResetButtonStatu();
|
| | | };
|
| | |
|
| | | return frameBack;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | /// <summary>
|
| | | /// 发送验证码
|
| | | /// </summary>
|
| | | /// <param name="btnCode"></param>
|
| | | private void SetVerificationCode(NormalViewControl btnCode)
|
| | | /// <param name="control"></param>
|
| | | private void SendVerificationCode(NormalViewControl control)
|
| | | {
|
| | | string account = this.strPhoneEmail.StartsWith("+") == true ? UserCenterResourse.UserInfo.Phone : UserCenterResourse.UserInfo.Email;
|
| | | var sendCodePra = new SendCodePra();
|
| | | sendCodePra.Account = account;
|
| | | sendCodePra.AreaCode = Convert.ToInt32(UserCenterResourse.UserInfo.AreaCode);
|
| | | bool flage = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ForgetPassword", false, sendCodePra);
|
| | | if (flage == false)
|
| | | //检测输入的账号
|
| | | if (this.CheckInputAccount(1) == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //不能再点击
|
| | | control.CanClick = false;
|
| | |
|
| | | //可以开始校验验证码了
|
| | | this.canCheckCode = true;
|
| | | //控件不能再次按下
|
| | | btnCode.CanClick = false;
|
| | | btnCode.BackgroundColor = 0xfffebca9;
|
| | | //?s后重发
|
| | | string repeat = Language.StringByID(R.MyInternationalizationString.RepeatSend1);
|
| | | //有效时间60秒
|
| | | int waitime = 60;
|
| | | btnCode.Text = waitime + "s" + repeat;
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | var errorMsg = string.Empty;
|
| | | //手机
|
| | | if (this.SelectIndex == 1)
|
| | | {
|
| | | while (this.Parent != null)
|
| | | errorMsg = HdlAccountLogic.Current.SendVeriCodeToPhone(HdlUserCenterResourse.UserInfo.PhoneAreaCode, HdlUserCenterResourse.UserInfo.UserPhone, VerCodeType.A找回密码);
|
| | | }
|
| | | //邮箱
|
| | | else
|
| | | {
|
| | | errorMsg = HdlAccountLogic.Current.SendVeriCodeToEmail(HdlUserCenterResourse.UserInfo.UserEmail, VerCodeType.A找回密码);
|
| | | }
|
| | | if (errorMsg == null)
|
| | | {
|
| | | //发送验证码成功,请注意查收
|
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.SendVerificationCodeSuccess));
|
| | |
|
| | | control.BackgroundColor = UserCenterColor.Current.White;
|
| | | control.TextColor = ZigbeeColor.Current.GXCTextBlackColor;
|
| | |
|
| | | //启动倒计时
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | waitime--;
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | if (waitime == 0)
|
| | | //后重发
|
| | | string txtValue = Language.StringByID(R.MyInternationalizationString.SendVerificationCodeAgain);
|
| | | int timeOut = 60;
|
| | | while (timeOut > 0 && control.Parent != null)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (btnCode != null)
|
| | | {
|
| | | //获取验证码
|
| | | btnCode.TextID = R.MyInternationalizationString.uGetVerificationCode;
|
| | | //按键可以按下
|
| | | btnCode.CanClick = true;
|
| | | btnCode.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
|
| | | }
|
| | | control.Text = timeOut + "s" + txtValue;
|
| | | });
|
| | | break;
|
| | | timeOut--;
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | }
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (btnCode != null)
|
| | | {
|
| | | btnCode.Text = waitime + "s" + repeat;
|
| | | }
|
| | | }, ShowErrorMode.NO);
|
| | | }
|
| | | });
|
| | | control.TextID = R.MyInternationalizationString.SendVerificationCode;
|
| | | control.BackgroundColor = 0xFFFC744B;
|
| | | control.TextColor = ZigbeeColor.Current.GXCTextWhiteColor;
|
| | | control.CanClick = true;
|
| | | });
|
| | | });
|
| | | return;
|
| | | }
|
| | | this.btnErrorMsg.Text = errorMsg;
|
| | | control.CanClick = true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 验证码事件_________________________
|
| | | #region ■ 重置密码___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 验证码事件
|
| | | /// 重置密码
|
| | | /// </summary>
|
| | | /// <param name="control"></param>
|
| | | /// <param name="value"></param>
|
| | | private void txtCodeValueChangedEvent(View control, string value)
|
| | | private void ResetPassword()
|
| | | {
|
| | | if (btnMsgControl.Visible == true)
|
| | | {
|
| | | btnMsgControl.Visible = false;
|
| | | }
|
| | |
|
| | | //验证码长度
|
| | | int CodeLength = 6;
|
| | | if (value.Length < CodeLength)
|
| | | //检测输入的账号
|
| | | if (this.CheckInputAccount(2) == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (value.Length == CodeLength)
|
| | | //不能再点击
|
| | | this.btnReset.CanClick = false;
|
| | |
|
| | | var errorMsg = string.Empty;
|
| | | //手机
|
| | | if (this.SelectIndex == 1)
|
| | | {
|
| | | //还不能检测验证码
|
| | | if (this.canCheckCode == false)
|
| | | {
|
| | | btnMsgControl.Visible = true;
|
| | | return;
|
| | | }
|
| | | var txtCode = (TextInputControl)control;
|
| | | //终止事件
|
| | | txtCode.TextChangeEventHandler -= this.txtCodeValueChangedEvent;
|
| | | //验证验证码
|
| | | this.CheckVerificationCode(txtCode, value);
|
| | | errorMsg = HdlAccountLogic.Current.ResetPassword(HdlUserCenterResourse.UserInfo.UserPhone, ListNowInputControl[2].Text.Trim(), ListNowInputControl[0].Text.Trim());
|
| | | }
|
| | | //邮箱
|
| | | else
|
| | | {
|
| | | errorMsg = HdlAccountLogic.Current.ResetPassword(HdlUserCenterResourse.UserInfo.UserEmail, ListNowInputControl[2].Text.Trim(), ListNowInputControl[0].Text.Trim());
|
| | | }
|
| | | if (errorMsg == null)
|
| | | {
|
| | | //密码已经修改,请重新登录
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uPasswordIsHadChangedAndLoginAgain);
|
| | | this.ShowMassage(ShowMsgType.Normal, msg, () =>
|
| | | {
|
| | | //从新登录
|
| | | HdlAccountLogic.Current.ReLoginAgain(Common.Config.Instance.Account);
|
| | | }, Language.StringByID(R.MyInternationalizationString.Login));
|
| | | return;
|
| | | }
|
| | | this.btnErrorMsg.Text = errorMsg;
|
| | | //可以再次点击
|
| | | this.btnReset.CanClick = true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 校验验证码_________________________
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 验证验证码
|
| | | /// 检测重置按钮的状态
|
| | | /// </summary>
|
| | | private void CheckResetButtonStatu()
|
| | | {
|
| | | this.btnErrorMsg.Text = string.Empty;
|
| | | //只要有一个为空,则重置按钮不可用
|
| | | if (this.ListNowInputControl[0].Text.Trim() == string.Empty
|
| | | || this.ListNowInputControl[1].Text.Trim() == string.Empty
|
| | | || this.ListNowInputControl[2].Text.Trim() == string.Empty)
|
| | | {
|
| | | this.btnReset.CanClick = false;
|
| | | return;
|
| | | }
|
| | |
|
| | | this.btnReset.CanClick = true;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 检测输入的账号
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private void CheckVerificationCode(TextInputControl txtCode, string code)
|
| | | private bool CheckInputAccount(int div)
|
| | | {
|
| | | string account = this.strPhoneEmail.StartsWith("+") == true ? UserCenterResourse.UserInfo.Phone : UserCenterResourse.UserInfo.Email;
|
| | | var checkCodePra = new CheckCodePra();
|
| | | checkCodePra.Code = code;
|
| | | checkCodePra.Account = account;
|
| | |
|
| | | bool flage = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ValidatorCode", false, checkCodePra);
|
| | | if (flage == false)
|
| | | this.btnErrorMsg.Text = string.Empty;
|
| | | //手机
|
| | | if (this.SelectIndex == 1)
|
| | | {
|
| | | //验证码错误,请重新输入
|
| | | this.btnMsgControl.Visible = true;
|
| | | //事件还原
|
| | | txtCode.TextChangeEventHandler += this.txtCodeValueChangedEvent;
|
| | | return;
|
| | | if (HdlCheckLogic.Current.CheckPhoneNumber(HdlUserCenterResourse.UserInfo.UserPhone, CommonPage.PhoneZoneStr) == false)
|
| | | {
|
| | | this.btnErrorMsg.TextID = R.MyInternationalizationString.ThePhoneError;
|
| | | return false;
|
| | | }
|
| | | }
|
| | | //邮箱
|
| | | else
|
| | | {
|
| | | if (HdlCheckLogic.Current.CheckEmail(HdlUserCenterResourse.UserInfo.UserEmail) == false)
|
| | | {
|
| | | this.btnErrorMsg.TextID = R.MyInternationalizationString.TheEmailError;
|
| | | return false;
|
| | | }
|
| | | }
|
| | | if (div == 1)
|
| | | {
|
| | | //如果是发送验证码,则不需要检测密码
|
| | | return true;
|
| | | }
|
| | |
|
| | | var from = new ResetAccountPasswordForm();
|
| | | base.AddFromAndRemoveNowForm(from);
|
| | | }
|
| | | //先判断2次密码输入是否一致
|
| | | if (ListNowInputControl[1].Text != ListNowInputControl[2].Text)
|
| | | {
|
| | | this.btnErrorMsg.TextID = R.MyInternationalizationString.TwoPasswordInconsistency;
|
| | | return false;
|
| | | }
|
| | | if (HdlCheckLogic.Current.CheckPwdLength(ListNowInputControl[2].Text.Trim()) == false)
|
| | | {
|
| | | this.btnErrorMsg.TextID = R.MyInternationalizationString.ThePWDLengthError;
|
| | | return false;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 结构体_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 发送验证码的启动参数
|
| | | /// </summary>
|
| | | private class SendCodePra
|
| | | {
|
| | | /// <summary>
|
| | | /// 用户账号
|
| | | /// </summary>
|
| | | public string Account = UserCenterResourse.UserInfo.Phone;
|
| | | /// <summary>
|
| | | /// 公司编号,国内使用手机短信验证码时,此字段填入0,国外手机短信验证码,此字段填入4 |
| | | /// </summary>
|
| | | public int Company = Common.CommonPage.PhoneZoneStr == "86" ? 0 : 4;
|
| | | /// <summary>
|
| | | /// 语言
|
| | | /// </summary>
|
| | | public string Language = Shared.Language.CurrentLanguage;
|
| | | /// <summary>
|
| | | /// 国家地区代码,手机号发送验证码时使用
|
| | | /// </summary>
|
| | | public int AreaCode = 0;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 发送验证码的启动参数
|
| | | /// </summary>
|
| | | private class CheckCodePra
|
| | | {
|
| | | /// <summary>
|
| | | /// 用户账号
|
| | | /// </summary>
|
| | | public string Account = UserCenterResourse.UserInfo.Phone;
|
| | | /// <summary>
|
| | | /// 验证码
|
| | | /// </summary>
|
| | | public string Code = "0";
|
| | | /// <summary>
|
| | | /// 语言
|
| | | /// </summary>
|
| | | public string Language = Shared.Language.CurrentLanguage;
|
| | | /// <summary>
|
| | | /// 国家地区代码,手机号发送验证码时使用
|
| | | /// </summary>
|
| | | public int AreaCode = Convert.ToInt32(UserCenterResourse.UserInfo.AreaCode);
|
| | | return true;
|
| | | }
|
| | |
|
| | | #endregion
|