| | |
| | | /// <summary>
|
| | | /// 修改胁迫密码
|
| | | /// </summary>
|
| | | public class EdtiorCoercePasswordForm : UserCenterCommonForm
|
| | | public class EdtiorCoercePasswordForm : EditorCommonForm
|
| | | {
|
| | | /// <summary>
|
| | | /// 信息提示控件
|
| | | /// </summary>
|
| | | private ViewNormalControl txtMsg = null;
|
| | | private NormalViewControl txtMsg = null;
|
| | |
|
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | |
| | | }
|
| | |
|
| | | //初始化中部信息
|
| | | this.InitMiddleFrame();
|
| | | //this.InitMiddleFrame();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化中部信息
|
| | | /// </summary>
|
| | | private void InitMiddleFrame()
|
| | | {
|
| | | //请输入胁迫密码
|
| | | var btnTitle = new TitleViewControl();
|
| | | btnTitle.TextColor = UserCenterColor.Current.TextGrayColor;
|
| | | btnTitle.Y = Application.GetRealHeight(40);
|
| | | btnTitle.TextID = R.MyInternationalizationString.uPleaseInputCoercePassword;
|
| | | bodyFrameLayout.AddChidren(btnTitle);
|
| | | ///// <summary>
|
| | | ///// 初始化中部信息
|
| | | ///// </summary>
|
| | | //private void InitMiddleFrame()
|
| | | //{
|
| | | // //清空bodyFrame
|
| | | // this.ClearBodyFrame();
|
| | |
|
| | | //新密码
|
| | | string placeholderText = Language.StringByID(R.MyInternationalizationString.uNewPassword);
|
| | | var rowNewPsw = new RowPasswordControl();
|
| | | rowNewPsw.Y = btnTitle.Bottom;
|
| | | bodyFrameLayout.AddChidren(rowNewPsw);
|
| | | rowNewPsw.Init(placeholderText);
|
| | | // //请输入胁迫密码
|
| | | // var btnTitle = new TitleViewControl();
|
| | | // btnTitle.TextColor = UserCenterColor.Current.TextGrayColor;
|
| | | // btnTitle.Y = Application.GetRealHeight(40);
|
| | | // btnTitle.TextID = R.MyInternationalizationString.uPleaseInputCoercePassword;
|
| | | // bodyFrameLayout.AddChidren(btnTitle);
|
| | |
|
| | | //确认新密码
|
| | | placeholderText = Language.StringByID(R.MyInternationalizationString.uConfirmNewPassword);
|
| | | var rowConfirmPsw = new RowPasswordControl();
|
| | | rowConfirmPsw.Y = rowNewPsw.Bottom;
|
| | | bodyFrameLayout.AddChidren(rowConfirmPsw);
|
| | | rowConfirmPsw.Init(placeholderText);
|
| | | // //新密码
|
| | | // string placeholderText = Language.StringByID(R.MyInternationalizationString.uNewPassword);
|
| | | // var rowNewPsw = new RowPasswordControl();
|
| | | // rowNewPsw.Y = btnTitle.Bottom;
|
| | | // bodyFrameLayout.AddChidren(rowNewPsw);
|
| | | // rowNewPsw.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);
|
| | | // //确认新密码
|
| | | // placeholderText = Language.StringByID(R.MyInternationalizationString.uPleaseRepeatInputNewPassword);
|
| | | // var rowConfirmPsw = new RowPasswordControl();
|
| | | // rowConfirmPsw.Y = rowNewPsw.Bottom;
|
| | | // bodyFrameLayout.AddChidren(rowConfirmPsw);
|
| | | // rowConfirmPsw.Init(placeholderText);
|
| | |
|
| | | //完成
|
| | | var btnfinish = new TopLayoutFinshView();
|
| | | topFrameLayout.AddChidren(btnfinish); |
| | | btnfinish.MouseUpEventHandler += (sender, e) =>
|
| | | {
|
| | | //执行修改胁迫密码
|
| | | this.ChangedCoercePassword(rowNewPsw.Text, rowConfirmPsw.Text);
|
| | | };
|
| | | }
|
| | | // //提示信息
|
| | | // this.txtMsg = new NormalViewControl(800, true);
|
| | | // txtMsg.X = ControlCommonResourse.XXLeft;
|
| | | // txtMsg.Y = rowConfirmPsw.Bottom + Application.GetRealHeight(5);
|
| | | // txtMsg.TextColor = UserCenterColor.Current.Red;
|
| | | // bodyFrameLayout.AddChidren(txtMsg);
|
| | |
|
| | | /// <summary>
|
| | | /// 执行修改胁迫密码
|
| | | /// </summary>
|
| | | /// <param name="pswValue1">新密码</param>
|
| | | /// <param name="pswValue2">确认密码</param>
|
| | | private async void ChangedCoercePassword(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(5, pswValue1);
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | | // //完成
|
| | | // var btnfinish = new TopLayoutFinshView();
|
| | | // topFrameLayout.AddChidren(btnfinish);
|
| | | // btnfinish.MouseUpEventHandler += (sender, e) =>
|
| | | // {
|
| | | // //执行修改胁迫密码
|
| | | // this.ChangedCoercePassword(rowNewPsw.Text, rowConfirmPsw.Text);
|
| | | // };
|
| | | //}
|
| | |
|
| | | //胁迫密码已更新
|
| | | string Refmsg = Language.StringByID(R.MyInternationalizationString.uCoercePasswordRefreshMsg);
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | //刷新主界面
|
| | | this.LoadFormMethodByName("CoercePasswordMainForm", "InitMiddleFrame");
|
| | | ///// <summary>
|
| | | ///// 执行修改胁迫密码
|
| | | ///// </summary>
|
| | | ///// <param name="pswValue1">新密码</param>
|
| | | ///// <param name="pswValue2">确认密码</param>
|
| | | //private async void ChangedCoercePassword(string pswValue1, string pswValue2)
|
| | | //{
|
| | | // //检测密码
|
| | | // string msg = this.CheckPassword(pswValue1, pswValue2);
|
| | | // if (msg != string.Empty)
|
| | | // {
|
| | | // Application.RunOnMainThread(() =>
|
| | | // {
|
| | | // if (txtMsg != null)
|
| | | // {
|
| | | // txtMsg.Text = msg;
|
| | | // }
|
| | | // });
|
| | | // return;
|
| | | // }
|
| | | // //执行修改
|
| | | // bool result = await Common.LocalSafeguard.Current.ChangedUserPassword(5, pswValue1);
|
| | | // if (result == false)
|
| | | // {
|
| | | // return;
|
| | | // }
|
| | |
|
| | | var form = new PasswordRefreshMsgForm();
|
| | | this.AddFromAndRemoveNowForm(form, Refmsg);
|
| | | });
|
| | | }
|
| | | // //胁迫密码已更新
|
| | | // string Refmsg = Language.StringByID(R.MyInternationalizationString.uCoercePasswordRefreshMsg);
|
| | | // Application.RunOnMainThread(() =>
|
| | | // {
|
| | | // //刷新主界面
|
| | | // this.LoadFormMethodByName("CoercePasswordMainForm", "InitMiddleFrame");
|
| | |
|
| | | /// <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.Length < UserCenterResourse.PasswordLength)
|
| | | {
|
| | | //密码长度不低于{0}位数
|
| | | return string.Format(Language.StringByID(R.MyInternationalizationString.PswLengthMsg), UserCenterResourse.PasswordLength);
|
| | | }
|
| | | if (pswValue1 != pswValue2)
|
| | | {
|
| | | //两次输入的密码不一致
|
| | | return Language.StringByID(R.MyInternationalizationString.SecondPswNotEqual);
|
| | | }
|
| | | return string.Empty;
|
| | | }
|
| | | // var form = new PasswordRefreshMsgForm();
|
| | | // this.AddFromAndRemoveNowForm(form, Refmsg);
|
| | | // });
|
| | | //}
|
| | |
|
| | | ///// <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.Length < UserCenterResourse.PasswordLength)
|
| | | // {
|
| | | // //密码长度不低于{0}位数
|
| | | // return string.Format(Language.StringByID(R.MyInternationalizationString.PswLengthMsg), UserCenterResourse.PasswordLength);
|
| | | // }
|
| | | // if (pswValue1 != pswValue2)
|
| | | // {
|
| | | // //两次输入的密码不一致
|
| | | // return Language.StringByID(R.MyInternationalizationString.SecondPswNotEqual);
|
| | | // }
|
| | | // return string.Empty;
|
| | | //}
|
| | | }
|
| | | }
|