From 6fa9d69da922c8049f5acfcbb9ce9fd26811024c Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 16 四月 2020 17:10:57 +0800
Subject: [PATCH] 请合并代码
---
ZigbeeApp/Shared/Phone/UserCenter/Safety/CoercePswAddNewForm.cs | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 161 insertions(+), 0 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Safety/CoercePswAddNewForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Safety/CoercePswAddNewForm.cs
new file mode 100755
index 0000000..44de1b0
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Safety/CoercePswAddNewForm.cs
@@ -0,0 +1,161 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shared.Phone.UserCenter.Safety
+{
+ /// <summary>
+ /// 鍒涘缓鏂扮殑鑳佽揩瀵嗙爜
+ /// </summary>
+ public class CoercePswAddNewForm : EditorCommonForm
+ {
+ #region 鈻� 鍙橀噺澹版槑___________________________
+
+ /// <summary>
+ /// 瀵嗙爜鏀瑰彉浜嬩欢
+ /// </summary>
+ public Action<string> PasswordChangedEvent = null;
+ /// <summary>
+ /// 鐢ㄦ埛璐﹀彿
+ /// </summary>
+ private int pswNo = 5;
+ /// <summary>
+ /// 绗竴涓瘑鐮�
+ /// </summary>
+ private string firstPsw = string.Empty;
+ /// <summary>
+ /// 瀵嗙爜杈撳叆鎺т欢
+ /// </summary>
+ private PswNumberInputControl pswControl = null;
+
+ #endregion
+
+ #region 鈻� 鍒濆鍖朹____________________________
+
+ /// <summary>
+ /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
+ /// </summary>
+ /// <param name="i_pswTip">瀵嗙爜澶囨敞</param>
+ public void ShowForm(string i_pswTip)
+ {
+ //璁剧疆澶撮儴淇℃伅
+ base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uCoercePassword));
+
+ //鍒濆鍖栦腑閮ㄤ俊鎭�
+ this.InitMiddleFrame(i_pswTip);
+ }
+
+ /// <summary>
+ /// 鍒濆鍖栦腑閮ㄤ俊鎭�
+ /// </summary>
+ /// <param name="i_pswTip">瀵嗙爜澶囨敞</param>
+ private void InitMiddleFrame(string i_pswTip)
+ {
+ //娓呯┖bodyFrame
+ this.ClearBodyFrame();
+
+ //璇疯緭鍏ユ柊鑳佽揩瀵嗙爜
+ pswControl = new PswNumberInputControl(Language.StringByID(R.MyInternationalizationString.uPleaseInputNewCoercePassword), 4);
+ pswControl.NumberIconBackColor = UserCenterColor.Current.White;
+ pswControl.Gravity = Gravity.CenterHorizontal;
+ pswControl.Y = Application.GetRealHeight(102);
+ bodyFrameLayout.AddChidren(pswControl);
+ pswControl.InitControl();
+
+ pswControl.FinishInputEvent += (pssword) =>
+ {
+ if (firstPsw != string.Empty)
+ {
+ //妫�娴嬪瘑鐮�
+ string msg = this.CheckPassword(firstPsw, pssword);
+ if (msg != string.Empty)
+ {
+ //璁剧疆閿欒淇℃伅
+ pswControl.SetErrorMsg(msg);
+ return;
+ }
+ //鎵ц淇敼鐢ㄦ埛瀵嗙爜
+ this.ChangedAdminPassword(firstPsw, i_pswTip);
+ }
+ else
+ {
+ firstPsw = pssword;
+ //璇烽噸澶嶈緭鍏ユ柊鑳佽揩瀵嗙爜
+ pswControl.ResetControlInfo(Language.StringByID(R.MyInternationalizationString.uPleaseRepeatInputNewCoercePassword));
+ }
+ };
+ }
+
+ #endregion
+
+ #region 鈻� 淇敼瀵嗙爜___________________________
+
+ /// <summary>
+ /// 鎵ц淇敼鐢ㄦ埛瀵嗙爜
+ /// </summary>
+ /// <param name="pswValue1">鏂板瘑鐮�</param>
+ private async void ChangedAdminPassword(string pswValue1, string i_titleText)
+ {
+ //鎵ц淇敼
+ bool result = await HdlSafeguardLogic.Current.ChangedUserPassword(this.pswNo, pswValue1, string.Empty);
+ if (result == false)
+ {
+ firstPsw = string.Empty;
+ //璇疯緭鍏ユ柊鑳佽揩瀵嗙爜
+ pswControl.ResetControlInfo(Language.StringByID(R.MyInternationalizationString.uPleaseInputNewCoercePassword));
+
+ return;
+ }
+
+ //鑳佽揩瀵嗙爜璁剧疆鎴愬姛
+ string msg = Language.StringByID(R.MyInternationalizationString.uSetCoercePasswordSuccess);
+ this.ShowMassage(ShowMsgType.Tip, msg);
+
+ //鐣岄潰鐩存帴鍏抽棴
+ this.CloseForm();
+
+ if (UserCenterResourse.DicActionForm.ContainsKey("CoercePswEditorForm") == false)
+ {
+ var form = new CoercePswEditorForm();
+ form.AddForm(pswValue1, i_titleText);
+ }
+ else
+ {
+ //鍥炶皟鍑芥暟
+ this.PasswordChangedEvent?.Invoke(pswValue1);
+ this.PasswordChangedEvent = null;
+ }
+ }
+
+ #endregion
+
+ #region 鈻� 涓�鑸柟娉昣__________________________
+
+ /// <summary>
+ /// 瀵嗙爜妫�鏌ワ紝杩斿洖閿欒淇℃伅锛屾棤閿欒淇℃伅(绌哄瓧绗︿覆)鍒欒〃绀烘垚鍔�
+ /// </summary>
+ /// <param name="pswValue1"></param>
+ /// <param name="pswValue2"></param>
+ /// <returns></returns>
+ private string CheckPassword(string pswValue1, string pswValue2)
+ {
+ if (pswValue1 == string.Empty)
+ {
+ //璇疯緭鍏ユ柊瀵嗙爜
+ return Language.StringByID(R.MyInternationalizationString.uPleaseInputNewPassword);
+ }
+ if (pswValue2 == string.Empty)
+ {
+ //璇疯緭鍏ョ‘璁ゅ瘑鐮�
+ return Language.StringByID(R.MyInternationalizationString.PleaseInputConfirmPsw);
+ }
+ if (pswValue1 != pswValue2)
+ {
+ //涓ゆ杈撳叆鐨勫瘑鐮佷笉涓�鑷�
+ return Language.StringByID(R.MyInternationalizationString.SecondPswNotEqual1);
+ }
+ return string.Empty;
+ }
+ #endregion
+ }
+}
--
Gitblit v1.8.0