| | |
| | | using System; |
| | | using System.Threading; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | |
| | |
| | | |
| | | Button btnResend; |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | Button btnTip; |
| | | |
| | | int titleId; |
| | | |
| | | ///// <summary> |
| | | ///// 操作类型 1:邮箱,2:手机 |
| | | ///// </summary> |
| | | //int optionType; |
| | | /// <summary> |
| | | /// 操作类型 1:邮箱,2:手机 |
| | | /// 是否手机 |
| | | /// </summary> |
| | | int optionType; |
| | | bool isPhone; |
| | | /// <summary> |
| | | /// 账号 |
| | | /// </summary> |
| | | string account; |
| | | |
| | | |
| | | public ResetPasswordVerificationCodePage() |
| | | { |
| | | bodyView = this; |
| | | } |
| | | |
| | | public void LoadPage(int tId, int ot) |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="tId"></param> |
| | | /// <param name="isPhone">是否手机</param> |
| | | /// <param name="account">账号</param> |
| | | public void LoadPage(int tId, bool isPhone, string account) |
| | | { |
| | | titleId = tId; |
| | | optionType = ot; |
| | | this.isPhone = isPhone; |
| | | this.account = account; |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | new TopViewDiv(bodyView, Language.StringByID(tId)).LoadTopView(); |
| | | |
| | | Button btnTip = new Button() |
| | | Action backAction = () => |
| | | { |
| | | Application.HideSoftInput(); |
| | | BackConfirmAction(); |
| | | }; |
| | | new TopViewDiv(bodyView, Language.StringByID(tId), false).LoadTopView(backAction); |
| | | |
| | | //new TopViewDiv(bodyView, Language.StringByID(tId)).LoadTopView(); |
| | | |
| | | btnTip = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | X = Application.GetRealWidth(16), |
| | |
| | | Y = Application.GetRealHeight(276), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealHeight(44), |
| | | Height = Application.GetRealWidth(44), |
| | | SelectedBackgroundColor = CSS_Color.MainColor, |
| | | BackgroundColor = CSS_Color.PromptingColor1, |
| | | TextAlignment = TextAlignment.Center, |
| | |
| | | /// </summary> |
| | | void LoadEvent_VerificationEntryEvent() |
| | | { |
| | | EventHandler<MouseEventArgs> clickEvent = (sender, e) => { |
| | | EventHandler<MouseEventArgs> clickEvent = (sender, e) => |
| | | { |
| | | et.Foucs = true; |
| | | var etCode = et.Text; |
| | | switch (etCode.Length) |
| | |
| | | btnNum5.MouseUpEventHandler = clickEvent; |
| | | btnNum6.MouseUpEventHandler = clickEvent; |
| | | |
| | | et.TextChangeEventHandler = (sender, e) => { |
| | | et.TextChangeEventHandler = (sender, e) => |
| | | { |
| | | var etCode = et.Text; |
| | | switch (etCode.Length) |
| | | { |
| | |
| | | btnNum4Line.Height = Application.GetRealHeight(1); |
| | | btnNum5Line.Height = Application.GetRealHeight(1); |
| | | btnNum6Line.Height = Application.GetRealHeight(1); |
| | | btnNum1Line.Text = ""; |
| | | btnNum2Line.Text = ""; |
| | | btnNum3Line.Text = ""; |
| | | btnNum4Line.Text = ""; |
| | | btnNum5Line.Text = ""; |
| | | btnNum6Line.Text = ""; |
| | | btnNum1.Text = ""; |
| | | btnNum2.Text = ""; |
| | | btnNum3.Text = ""; |
| | | btnNum4.Text = ""; |
| | | btnNum5.Text = ""; |
| | | btnNum6.Text = ""; |
| | | break; |
| | | case 1: |
| | | btnNum2Line.IsSelected = true; |
| | |
| | | btnNum4Line.Height = Application.GetRealHeight(1); |
| | | btnNum5Line.Height = Application.GetRealHeight(1); |
| | | btnNum6Line.Height = Application.GetRealHeight(1); |
| | | btnNum2Line.Text = ""; |
| | | btnNum3Line.Text = ""; |
| | | btnNum4Line.Text = ""; |
| | | btnNum5Line.Text = ""; |
| | | btnNum6Line.Text = ""; |
| | | btnNum2.Text = ""; |
| | | btnNum3.Text = ""; |
| | | btnNum4.Text = ""; |
| | | btnNum5.Text = ""; |
| | | btnNum6.Text = ""; |
| | | break; |
| | | case 2: |
| | | btnNum3Line.IsSelected = true; |
| | |
| | | btnNum4Line.Height = Application.GetRealHeight(1); |
| | | btnNum5Line.Height = Application.GetRealHeight(1); |
| | | btnNum6Line.Height = Application.GetRealHeight(1); |
| | | btnNum3Line.Text = ""; |
| | | btnNum4Line.Text = ""; |
| | | btnNum5Line.Text = ""; |
| | | btnNum6Line.Text = ""; |
| | | btnNum3.Text = ""; |
| | | btnNum4.Text = ""; |
| | | btnNum5.Text = ""; |
| | | btnNum6.Text = ""; |
| | | break; |
| | | case 3: |
| | | btnNum4Line.IsSelected = true; |
| | |
| | | btnNum4Line.Height = Application.GetRealHeight(2); |
| | | btnNum5Line.Height = Application.GetRealHeight(1); |
| | | btnNum6Line.Height = Application.GetRealHeight(1); |
| | | btnNum4Line.Text = ""; |
| | | btnNum5Line.Text = ""; |
| | | btnNum6Line.Text = ""; |
| | | btnNum4.Text = ""; |
| | | btnNum5.Text = ""; |
| | | btnNum6.Text = ""; |
| | | break; |
| | | case 4: |
| | | btnNum5Line.IsSelected = true; |
| | |
| | | btnNum4Line.Height = Application.GetRealHeight(1); |
| | | btnNum5Line.Height = Application.GetRealHeight(2); |
| | | btnNum6Line.Height = Application.GetRealHeight(1); |
| | | btnNum5Line.Text = ""; |
| | | btnNum6Line.Text = ""; |
| | | btnNum5.Text = ""; |
| | | btnNum6.Text = ""; |
| | | break; |
| | | case 5: |
| | | btnNum6Line.IsSelected = true; |
| | |
| | | btnNum4Line.Height = Application.GetRealHeight(1); |
| | | btnNum5Line.Height = Application.GetRealHeight(1); |
| | | btnNum6Line.Height = Application.GetRealHeight(2); |
| | | btnNum6Line.Text = ""; |
| | | btnNum6.Text = ""; |
| | | break; |
| | | case 6: |
| | | btnNum6.Text = etCode.Substring(5, 1); |
| | | et.Foucs = false; |
| | | new Thread(() => |
| | | { |
| | | bool result = false; |
| | | Action act = () => { }; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | act = new PublicAssmebly().TipLoadingMsgDialog(Language.StringByID(StringId.SavingPleaseWait)); |
| | | }); |
| | | var response = new DAL.Server.HttpServerRequest().ValidatorCode(MainPage.LoginUser.userEmailInfo, etCode, MainPage.LoginUser.areaCode); |
| | | if (response.StateCode.ToUpper() == "SUCCESS") |
| | | { |
| | | result = true; |
| | | } |
| | | else |
| | | { |
| | | string erorrInfo = ""; |
| | | switch (response.StateCode) |
| | | { |
| | | case "ValidCodeAndPhoneNoEqual"://验证码错误 |
| | | erorrInfo = Language.StringByID(StringId.VerificationCodeWrong); |
| | | break; |
| | | case "NoRecord": |
| | | erorrInfo = Language.StringByID(StringId.PlsGetTheVerificationCode); |
| | | break; |
| | | default: |
| | | erorrInfo = "Server error"; |
| | | break; |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Direction = AMPopTipDirection.None, |
| | | Text = erorrInfo, |
| | | }.Show(bodyView); |
| | | }); |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | act(); |
| | | }); |
| | | if (result) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.ValidationSuccessful), true); |
| | | }); |
| | | Thread.Sleep(1600); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); |
| | | if (titleId == StringId.EmailVerification) |
| | | { |
| | | |
| | | } |
| | | else if (titleId == StringId.PhoneNumberVerification) |
| | | { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | //输入完成 |
| | | InputComplete(etCode); |
| | | break; |
| | | } |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 输入完成 |
| | | /// </summary> |
| | | /// <param name="etCode"></param> |
| | | void InputComplete(string etCode) |
| | | { |
| | | new Thread(() => |
| | | { |
| | | bool result = false; |
| | | Action act = () => { }; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | act = new PublicAssmebly().TipLoadingMsgDialog(Language.StringByID(StringId.SavingPleaseWait)); |
| | | }); |
| | | |
| | | var resultObj = new HttpServerRequest().ValidatorCode(VerifyType.FIND_PASSWORD, account, etCode, isPhone, false); |
| | | if (resultObj.Code == StateCode.SUCCESS) |
| | | { |
| | | result = true; |
| | | } |
| | | else |
| | | { |
| | | //失败提示 |
| | | IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | act(); |
| | | }); |
| | | if (result) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.ValidationSuccessful), true); |
| | | }); |
| | | Thread.Sleep(1600); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | |
| | | //MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); |
| | | this.RemoveFromParent(); |
| | | var vcp = new ResetPasswordPage(); |
| | | vcp.isPhone = isPhone; |
| | | vcp.account = account; |
| | | vcp.verCode = etCode; |
| | | MainPage.BasePageView.AddChidren(vcp); |
| | | vcp.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 重发验证码等待线程 |
| | | /// </summary> |
| | |
| | | btnResend.IsSelected = false; |
| | | int time = 60; |
| | | |
| | | //加载Loading效果 |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | |
| | | new Thread(() => |
| | | { |
| | | if (optionType == 1) |
| | | try |
| | | { |
| | | var result = new DAL.Server.HttpServerRequest().GetLoginVerCode(MainPage.LoginUser.userEmailInfo); |
| | | //2.2 获取验证码 |
| | | ResponsePackNew resultObj; |
| | | if (!isPhone) |
| | | { |
| | | resultObj = new DAL.Server.HttpServerRequest().VerificationCodeSend(VerifyType.FIND_PASSWORD, account); |
| | | } |
| | | else |
| | | { |
| | | resultObj = new DAL.Server.HttpServerRequest().VerificationCodeSend(VerifyType.FIND_PASSWORD, account, true, UserInfo.Current.areaCode.ToString()); |
| | | } |
| | | |
| | | if (resultObj.Code != StateCode.SUCCESS) |
| | | { |
| | | //发送失败 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTip.TextID = StringId.FailedToSendVerificationCode; |
| | | }); |
| | | //失败提示 |
| | | IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); |
| | | } |
| | | else |
| | | { |
| | | new Thread(() => |
| | | { |
| | | //发送成功,开始倒计时 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTip.TextID = StringId.VerificationCodePrompt; |
| | | }); |
| | | |
| | | while (time > 0) |
| | | { |
| | | time--; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnResend.Text = time.ToString() + "s"; |
| | | }); |
| | | Thread.Sleep(1000); |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnResend.IsSelected = true; |
| | | btnResend.TextID = StringId.GetVerificationCode; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | } |
| | | else if (optionType == 2) |
| | | catch { } |
| | | finally |
| | | { |
| | | var result = new DAL.Server.HttpServerRequest().GetLoginVerCode(MainPage.LoginUser.userMobileInfo); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | new Thread(() => |
| | | { |
| | | while (time > 0) |
| | | { |
| | | time--; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnResend.Text = time.ToString() + "s"; |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | Thread.Sleep(1000); |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnResend.IsSelected = true; |
| | | btnResend.TextID = StringId.GetVerificationCode; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 重发验证码事件 |
| | | /// </summary> |
| | | void LoadEvent_Resend() |
| | | { |
| | | btnResend.MouseUpEventHandler = (sender, e) => { |
| | | btnResend.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | LoadThread_SendVerCode(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 返回二次确认事件 |
| | | /// </summary> |
| | | void BackConfirmAction() |
| | | { |
| | | //验证码发送成功,二次确认退出 |
| | | if (btnTip.TextID == StringId.VerificationCodePrompt) |
| | | { |
| | | Action cancelAction = () => |
| | | { |
| | | if (bodyView != null) |
| | | { |
| | | bodyView.RemoveFromParent(); |
| | | } |
| | | }; |
| | | new ConfirmDialog().ShowDialog(StringId.Tip, StringId.VerificationCodeMayBeDelayed, null, cancelAction, StringId.ReturnStr, StringId.WaitAMoment); |
| | | } |
| | | else |
| | | { |
| | | //直接关闭 |
| | | if (bodyView != null) |
| | | { |
| | | bodyView.RemoveFromParent(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |