| | |
| | | /// <summary>
|
| | | /// 修改用户密码的画面
|
| | | /// </summary>
|
| | | public class EdtiorUserPasswordForm : UserCenterCommonForm
|
| | | public class EdtiorUserPasswordForm : EditorCommonForm
|
| | | {
|
| | | /// <summary>
|
| | | /// 信息提示控件
|
| | | /// </summary>
|
| | | private ViewNormalControl txtMsg = null;
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 用户账号
|
| | | /// </summary>
|
| | | private int pswNo = 0;
|
| | | /// <summary>
|
| | | /// 第一个密码
|
| | | /// </summary>
|
| | | private string firstPsw = string.Empty;
|
| | | /// <summary>
|
| | | /// 密码输入控件
|
| | | /// </summary>
|
| | | private PswNumberInputControl pswControl = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | | /// <param name="i_pswNo">用户账号</param>
|
| | | /// <param name="addModel">是否是添加用户密码模式</param>
|
| | | public void ShowForm(int i_pswNo, bool addModel)
|
| | | /// <param name="i_titleText">头部标题信息</param>
|
| | | public void ShowForm(int i_pswNo, string i_titleText)
|
| | | {
|
| | | this.pswNo = i_pswNo;
|
| | |
|
| | | if (addModel == true)
|
| | | {
|
| | | //设置头部信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddPassword));
|
| | | }
|
| | | else
|
| | | {
|
| | | //设置头部信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uChangedPassword));
|
| | | }
|
| | | base.SetTitleText(i_titleText);
|
| | |
|
| | | //初始化中部信息
|
| | | this.InitMiddleFrame();
|
| | |
| | | /// </summary>
|
| | | private void InitMiddleFrame()
|
| | | {
|
| | | //请输入用户密码
|
| | | var btnTitle = new TitleViewControl();
|
| | | btnTitle.TextColor = UserCenterColor.Current.TextGrayColor;
|
| | | btnTitle.Y = Application.GetRealHeight(40);
|
| | | btnTitle.TextID = R.MyInternationalizationString.uPleaseInputUserPassword;
|
| | | bodyFrameLayout.AddChidren(btnTitle);
|
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | //新密码
|
| | | string placeholderText = Language.StringByID(R.MyInternationalizationString.uNewPassword);
|
| | | var rowNewPsw = new RowPasswordControl();
|
| | | rowNewPsw.Y = btnTitle.Bottom;
|
| | | bodyFrameLayout.AddChidren(rowNewPsw);
|
| | | rowNewPsw.Init(placeholderText);
|
| | | //请输入新安防密码
|
| | | pswControl = new PswNumberInputControl(Language.StringByID(R.MyInternationalizationString.uPleaseInputNewSafetyPassword), 4);
|
| | | bodyFrameLayout.AddChidren(pswControl);
|
| | | pswControl.InitControl();
|
| | |
|
| | | //确认新密码
|
| | | placeholderText = Language.StringByID(R.MyInternationalizationString.uConfirmNewPassword);
|
| | | var rowConfirmPsw = new RowPasswordControl();
|
| | | rowConfirmPsw.Y = rowNewPsw.Bottom;
|
| | | bodyFrameLayout.AddChidren(rowConfirmPsw);
|
| | | rowConfirmPsw.Init(placeholderText);
|
| | |
|
| | | //提示信息
|
| | | this.txtMsg = new ViewNormalControl(800, true);
|
| | | txtMsg.X = ControlCommonResourse.XXLeft;
|
| | | txtMsg.Y = rowConfirmPsw.Bottom + Application.GetRealHeight(5);
|
| | | txtMsg.TextColor = UserCenterColor.Current.Red;
|
| | | bodyFrameLayout.AddChidren(txtMsg);
|
| | |
|
| | | //完成
|
| | | var btnfinish = new TopLayoutFinshView();
|
| | | topFrameLayout.AddChidren(btnfinish); |
| | | btnfinish.MouseUpEventHandler += (sender, e) =>
|
| | | pswControl.FinishInputEvent += (pssword) =>
|
| | | {
|
| | | if (firstPsw != string.Empty)
|
| | | {
|
| | | //检测密码
|
| | | string msg = this.CheckPassword(firstPsw, pssword);
|
| | | if (msg != string.Empty)
|
| | | {
|
| | | //请重复输入新安防密码
|
| | | pswControl.ResetControlInfo(Language.StringByID(R.MyInternationalizationString.uPleaseRepeatInputNewSafetyPassword));
|
| | | //设置错误信息
|
| | | pswControl.SetErrorMsg(msg);
|
| | | return;
|
| | | }
|
| | | //执行修改用户密码
|
| | | this.ChangedAdminPassword(rowNewPsw.Text, rowConfirmPsw.Text);
|
| | | this.ChangedAdminPassword(firstPsw, pssword);
|
| | | }
|
| | | else
|
| | | {
|
| | | firstPsw = pssword;
|
| | | //请重复输入新安防密码
|
| | | pswControl.ResetControlInfo(Language.StringByID(R.MyInternationalizationString.uPleaseRepeatInputNewSafetyPassword));
|
| | | }
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 修改密码___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 执行修改用户密码
|
| | |
| | | /// <param name="pswValue2">确认密码</param>
|
| | | private async void ChangedAdminPassword(string pswValue1, string pswValue2)
|
| | | {
|
| | | //检测密码
|
| | | string msg = this.CheckPassword(pswValue1, pswValue2);
|
| | | if (msg != string.Empty)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | txtMsg.Text = msg;
|
| | | });
|
| | | return;
|
| | | }
|
| | | //执行修改
|
| | | bool result = await Common.LocalSafeguard.Current.ChangedUserPassword(this.pswNo, pswValue1);
|
| | | bool result = await HdlSafeguardLogic.Current.ChangedUserPassword(this.pswNo, pswValue1);
|
| | | if (result == false)
|
| | | {
|
| | | firstPsw = string.Empty;
|
| | | //请输入新安防密码
|
| | | pswControl.ResetControlInfo(Language.StringByID(R.MyInternationalizationString.uPleaseInputNewSafetyPassword));
|
| | |
|
| | | return;
|
| | | }
|
| | |
|
| | | //用户密码已更新
|
| | | string Refmsg = Language.StringByID(R.MyInternationalizationString.uUserPasswordRefreshMsg);
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | //刷新主界面
|
| | | this.LoadFormMethodByName("UserPasswordMainForm", "InitMiddleFrame");
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uUserPasswordRefreshMsg);
|
| | | this.ShowMassage(ShowMsgType.Tip, msg);
|
| | |
|
| | | var form = new PasswordRefreshMsgForm();
|
| | | this.AddFromAndRemoveNowForm(form, Refmsg);
|
| | | });
|
| | | //界面直接关闭(暂时)
|
| | | this.CloseForm();
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 密码检查,返回错误信息,无错误信息(空字符串)则表示成功
|
| | |
| | | //请输入确认密码
|
| | | return Language.StringByID(R.MyInternationalizationString.PleaseInputConfirmPsw);
|
| | | }
|
| | | if (pswValue1.Length < UserCenterResourse.PasswordLength)
|
| | | {
|
| | | //密码长度不低于{0}位数
|
| | | return string.Format(Language.StringByID(R.MyInternationalizationString.PswLengthMsg), UserCenterResourse.PasswordLength);
|
| | | }
|
| | | if (pswValue1 != pswValue2)
|
| | | {
|
| | | //两次输入的密码不一致
|
| | | return Language.StringByID(R.MyInternationalizationString.SecondPswNotEqual);
|
| | | return Language.StringByID(R.MyInternationalizationString.SecondPswNotEqual1);
|
| | | }
|
| | | return string.Empty;
|
| | | }
|
| | | #endregion
|
| | | }
|
| | | }
|