From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 17 十二月 2020 09:07:13 +0800
Subject: [PATCH] 新云端Ver1.3
---
ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs | 172 ++++++++++++++++----------------------------------------
1 files changed, 50 insertions(+), 122 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs
index 5b796b4..7fa65a7 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Password/CheckNewEmailForm.cs
@@ -23,6 +23,10 @@
/// 鏍囪鏄惁鑳藉鏍¢獙楠岃瘉鐮佷簡
/// </summary>
private bool canCheckCode = false;
+ /// <summary>
+ /// 鑳藉惁鍙戦�侀獙璇佺爜
+ /// </summary>
+ private bool canSendCode = true;
#endregion
@@ -55,18 +59,20 @@
frame.Height = Application.GetRealHeight(127);
bodyFrameLayout.AddChidren(frame);
//杈撳叆妗�
- var txtValue = new TextInputControl(frame.Width - Application.GetRealWidth(20), frame.Height - ControlCommonResourse.BottomLineHeight, false);
+ var txtValue = new TextInputControl(frame.Width - Application.GetRealWidth(20), frame.Height - HdlControlResourse.BottomLineHeight, false);
txtValue.X = Application.GetRealWidth(10);
txtValue.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputNewEmailAddress);
frame.AddChidren(txtValue);
//绾�
- var btnLine = new NormalViewControl(frame.Width, ControlCommonResourse.BottomLineHeight, false);
+ var btnLine = new NormalViewControl(frame.Width, HdlControlResourse.BottomLineHeight, false);
btnLine.Y = txtValue.Bottom;
btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
frame.AddChidren(btnLine);
+ //鑱斿姩绾跨殑鐘舵��
+ txtValue.btnLine = btnLine;
- if (string.IsNullOrEmpty(UserCenterResourse.UserInfo.Email) == false)
+ if (string.IsNullOrEmpty(HdlUserCenterResourse.UserInfo.UserEmail) == false)
{
//纭韬唤鎴愬姛锛岃缁戝畾鏂伴偖绠�
var btnMsg1 = new NormalViewControl(800, 49, false);
@@ -92,8 +98,8 @@
};
btnCodeControl.FinishInputEvent += (value) =>
{
- //鏍¢獙楠岃瘉鐮�
- this.CheckVerificationCode(value);
+ //缁戝畾鏂伴偖绠�
+ this.SaveNewEmail(btnCodeControl, value);
};
//楠岃瘉鐮侀敊璇紝璇烽噸鏂拌緭鍏�
@@ -102,6 +108,7 @@
btnErrorMsg.TextAlignment = TextAlignment.Center;
btnErrorMsg.TextColor = 0xfff75858;
btnErrorMsg.TextID = R.MyInternationalizationString.uVerificationCodeErrorInputAgain;
+ btnErrorMsg.IsBold = true;
bodyFrameLayout.AddChidren(btnErrorMsg);
btnErrorMsg.Visible = false;
@@ -113,6 +120,9 @@
btnOk.CanClick = false;
btnOk.ButtonClickEvent += (sender, e) =>
{
+ //娓呯┖杈撳叆鐨勫��
+ btnCodeControl.ClearInputValue();
+
this.btnErrorMsg.Visible = false;
//妫�娴嬮偖绠辩殑鍦板潃
if (this.CheckEmail(txtValue.Text.Trim()) == false)
@@ -145,17 +155,18 @@
/// <summary>
/// 鍙戦�侀獙璇佺爜鍒伴偖绠�
/// </summary>
- private async void SendCodeToEmail(BottomClickButton btnNext, string Email)
+ private void SendCodeToEmail(BottomClickButton btnNext, string Email)
{
- var sendCodePra = new SendCodePra();
- sendCodePra.Account = Email;
-
- bool falge = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/RegisterSendVerCode", false, sendCodePra);
- if (falge == false)
+ var errorMsg = HdlAccountLogic.Current.SendVeriCodeToEmail(Email, VerCodeType.A缁戝畾);
+ if (errorMsg != null)
{
+ //鏄剧ず閿欒
+ this.btnErrorMsg.Visible = true;
+ this.btnErrorMsg.Text = errorMsg;
return;
}
-
+ //涓嶈兘鍐嶅彂閫侀獙璇佺爜
+ this.canSendCode = false;
//鍙互寮�濮嬫牎楠岄獙璇佺爜浜�
this.canCheckCode = true;
//璁板綍璧疯繖涓偖绠�,闃叉鎭舵剰鍙樻洿
@@ -170,82 +181,60 @@
HdlThreadLogic.Current.RunThread(() =>
{
- while (this.Parent != null)
+ while (this.Parent != null && this.canSendCode == false)
{
waitime--;
System.Threading.Thread.Sleep(1000);
if (waitime == 0)
{
- Application.RunOnMainThread(() =>
- {
- if (btnNext != null)
- {
- //鑾峰彇楠岃瘉鐮�
- btnNext.TextID = R.MyInternationalizationString.uGetVerificationCode;
- //鎸夐敭鍙互鎸変笅
- btnNext.CanClick = true;
- }
- });
break;
}
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
if (btnNext != null)
{
btnNext.Text = waitime + "s" + repeat;
}
- });
+ }, ShowErrorMode.NO);
}
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ if (btnNext != null)
+ {
+ //鑾峰彇楠岃瘉鐮�
+ btnNext.TextID = R.MyInternationalizationString.uGetVerificationCode;
+ //鎸夐敭鍙互鎸変笅
+ btnNext.CanClick = true;
+ }
+ });
});
}
#endregion
- #region 鈻� 鏍¢獙楠岃瘉鐮乢________________________
+ #region 鈻� 鍙樻洿閭___________________________
/// <summary>
- /// 楠岃瘉楠岃瘉鐮�
+ /// 鍙樻洿閭
/// </summary>
- /// <returns></returns>
- private async void CheckVerificationCode(string code)
+ private void SaveNewEmail(VerificationCodeControl btnCodeControl, string code)
{
if (this.canCheckCode == false)
{
//楠岃瘉鐮侀敊璇紝璇烽噸鏂拌緭鍏�
this.btnErrorMsg.Visible = true;
this.btnErrorMsg.TextID = R.MyInternationalizationString.uVerificationCodeErrorInputAgain;
+ //娓呯┖杈撳叆鍊�
+ btnCodeControl.ClearInputValue();
return;
}
- var checkCodePra = new CheckCodePra();
- checkCodePra.Code = code;
- checkCodePra.Account = newEmail;
-
- bool flage = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ValidatorCode", false, checkCodePra);
- if (flage == false)
+ //鎵ц缁戝畾
+ var errorMsg = HdlAccountLogic.Current.BindAccount(this.newEmail, code);
+ if (errorMsg != null)
{
- //楠岃瘉鐮侀敊璇紝璇烽噸鏂拌緭鍏�
- this.btnErrorMsg.Visible = true;
- this.btnErrorMsg.TextID = R.MyInternationalizationString.uVerificationCodeErrorInputAgain;
- return;
- }
-
- //鍙樻洿閭
- this.SaveNewEmail();
- }
-
- /// <summary>
- /// 鍙樻洿閭
- /// </summary>
- private async void SaveNewEmail()
- {
- var pra = new SaveNewEmailPra();
- pra.Account = this.newEmail;
-
- bool flage = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/BindAccount", false, pra);
- if (flage == false)
- {
- //缁戝畾閭澶辫触
- this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uBindEmailFail));
+ this.ShowMassage(ShowMsgType.Tip, errorMsg);
+ //鍙互閲嶆柊鍙戦�侀獙璇佺爜
+ this.canSendCode = true;
return;
}
@@ -264,13 +253,13 @@
private void RefreshUserInfoForm()
{
//濡傛灉淇敼鐨勬槸璐﹀彿鐨勮瘽,鍒欓噸鏂扮櫥褰�
- if (UserCenterResourse.UserInfo.Email == Shared.Common.Config.Instance.Account)
+ if (HdlUserCenterResourse.UserInfo.UserEmail == Shared.Common.Config.Instance.Account)
{
- UserCenterLogic.ReLoginAgain(this.newEmail);
+ HdlAccountLogic.Current.ReLoginAgain(this.newEmail);
return;
}
- UserCenterResourse.UserInfo.Email = this.newEmail;
+ HdlUserCenterResourse.UserInfo.UserEmail = this.newEmail;
this.CloseForm();
}
@@ -302,67 +291,6 @@
}
return true;
- }
-
- #endregion
-
- #region 鈻� 缁撴瀯浣揰____________________________
-
- /// <summary>
- /// 鍙戦�侀獙璇佺爜鐨勫惎鍔ㄥ弬鏁�
- /// </summary>
- private class SendCodePra
- {
- /// <summary>
- /// 鐢ㄦ埛璐﹀彿
- /// </summary>
- public string Account = string.Empty;
- /// <summary>
- /// 鍏徃缂栧彿,鍥藉唴浣跨敤鎵嬫満鐭俊楠岃瘉鐮佹椂锛屾瀛楁濉叆0锛屽浗澶栨墜鏈虹煭淇¢獙璇佺爜锛屾瀛楁濉叆4
- /// </summary>
- public int Company = Common.CommonPage.PhoneZoneStr == "86" ? 0 : 4;
- /// <summary>
- /// 璇█
- /// </summary>
- public string Language = Shared.Language.CurrentLanguage;
- /// <summary>
- /// 鍥藉鍦板尯浠g爜锛屾墜鏈哄彿鍙戦�侀獙璇佺爜鏃朵娇鐢�
- /// </summary>
- public int AreaCode = 0;
- }
-
- /// <summary>
- /// 鍙戦�侀獙璇佺爜鐨勫惎鍔ㄥ弬鏁�
- /// </summary>
- private class CheckCodePra
- {
- /// <summary>
- /// 鐢ㄦ埛璐﹀彿
- /// </summary>
- public string Account = string.Empty;
- /// <summary>
- /// 楠岃瘉鐮�
- /// </summary>
- public string Code = "0";
- /// <summary>
- /// 璇█
- /// </summary>
- public string Language = Shared.Language.CurrentLanguage;
- /// <summary>
- /// 鍥藉鍦板尯浠g爜锛屾墜鏈哄彿鍙戦�侀獙璇佺爜鏃朵娇鐢�
- /// </summary>
- public int AreaCode = 0;
- }
-
- /// <summary>
- /// 淇濆瓨鏂伴偖绠辩殑鍚姩鍙傛暟
- /// </summary>
- private class SaveNewEmailPra
- {
- /// <summary>
- /// 鏂扮敤鎴疯处鍙�
- /// </summary>
- public string Account = string.Empty;
}
#endregion
--
Gitblit v1.8.0