From 5bfb959c47017825c8cf7dc8570c55b04dab694c Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 09 六月 2021 16:42:11 +0800 Subject: [PATCH] Merge branch 'dev-tzy' into wxr6 --- HDL_ON/UI/UI0-Stan/Form/AppNumPasswordSecurityForm.cs | 233 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 233 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI0-Stan/Form/AppNumPasswordSecurityForm.cs b/HDL_ON/UI/UI0-Stan/Form/AppNumPasswordSecurityForm.cs new file mode 100644 index 0000000..f2f5ec2 --- /dev/null +++ b/HDL_ON/UI/UI0-Stan/Form/AppNumPasswordSecurityForm.cs @@ -0,0 +1,233 @@ +锘縰sing HDL_ON.UI.CSS; +using Shared; +using System; +using System.Collections.Generic; +using System.Text; + +namespace HDL_ON.Stan +{ + /// <summary> + /// App鏁板瓧瀵嗙爜楠岃瘉鐣岄潰 + /// </summary> + public class AppNumPasswordSecurityForm : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// <para>Action浜嬩欢</para> + /// <para>1:瀵嗙爜杈撳叆缁撴潫,杩欎釜鏃跺��,绗簩涓弬鏁颁负杈撳叆鐨勫瘑鐮�</para> + /// <para>2:鐐瑰嚮浜嗗簳閮ㄧ殑娑堟伅</para> + /// </summary> + public Action<int, string> ActionEvent = null; + /// <summary> + /// 鍥炬爣鎺т欢闆嗗悎 + /// </summary> + private List<IconViewControl> listIconContr = new List<IconViewControl>(); + /// <summary> + /// 娑堟伅鎺т欢 + /// </summary> + private NormalViewControl btnErrorMsg = null; + /// <summary> + /// 涓�涓珮搴︿负0鐨勮緭鍏ユ + /// </summary> + private EditText txtPassword = null; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + /// <param name="addTopFrame">鏄惁娣诲姞澶撮儴Frame</param> + /// <param name="i_title">鏍囬淇℃伅</param> + /// <param name="i_bottomMsg">搴曢儴鏄剧ず鐨勪俊鎭</param> + public void ShowForm(bool addTopFrame, string i_title, string i_bottomMsg) + { + //涓嶅厑璁稿乏婊� + this.ScrollLeftEnabled = false; + + if (addTopFrame == false) + { + //娓呯┖澶撮儴鍏ㄩ儴鎺т欢 + topFrameLayout.RemoveAll(); + //鐒跺悗璁╄儗鏅壊涓�浣撳寲 + topFrameLayout.BackgroundColor = bodyFrameLayout.BackgroundColor; + topMenuFrameLayout.BackgroundColor = bodyFrameLayout.BackgroundColor; + } + else + { + //楠岃瘉鏁板瓧瀵嗙爜 + base.SetTitleText(Language.StringByID(StringId.VerifyDigitalPassword)); + } + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(i_title, i_bottomMsg); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + /// <param name="i_title">鏍囬淇℃伅</param> + /// <param name="i_bottomMsg">搴曢儴鏄剧ず鐨勪俊鎭</param> + private void InitMiddleFrame(string i_title, string i_bottomMsg) + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + //鏍囬 + var btnTitle = new NormalViewControl(bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2, Application.GetRealHeight(42), false); + btnTitle.Y = Application.GetRealHeight(228) - topFrameLayout.Bottom; + btnTitle.Gravity = Gravity.CenterHorizontal; + btnTitle.TextAlignment = TextAlignment.Center; + btnTitle.TextColor = CSS_Color.FirstLevelTitleColor; + btnTitle.TextSize = CSS_FontSize.SubheadingFontSize; + btnTitle.Text = i_title; + bodyFrameLayout.AddChidren(btnTitle); + + //绗竴涓渾鍦� + var btnIcon1 = this.InitIconControl(); + btnIcon1.X = Application.GetRealWidth(132); + btnIcon1.Y = btnTitle.Bottom + Application.GetRealWidth(10); + + //绗簩涓渾鍦� + var btnIcon2 = this.InitIconControl(); + btnIcon2.X = btnIcon1.Right + Application.GetRealWidth(16); + btnIcon2.Y = btnIcon1.Y; + + //绗笁涓渾鍦� + var btnIcon3 = this.InitIconControl(); + btnIcon3.X = btnIcon2.Right + Application.GetRealWidth(16); + btnIcon3.Y = btnIcon1.Y; + + //绗洓涓渾鍦� + var btnIcon4 = this.InitIconControl(); + btnIcon4.X = btnIcon3.Right + Application.GetRealWidth(16); + btnIcon4.Y = btnIcon1.Y; + + //閿欒娑堟伅 + this.btnErrorMsg = new NormalViewControl(bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2, Application.GetRealHeight(24), false); + btnErrorMsg.Y = btnIcon1.Bottom + Application.GetRealHeight(4); + btnErrorMsg.Gravity = Gravity.CenterHorizontal; + btnErrorMsg.TextColor = CSS_Color.WarningColor; + btnErrorMsg.TextAlignment = TextAlignment.Center; + btnErrorMsg.IsMoreLines = true; + bodyFrameLayout.AddChidren(btnErrorMsg); + + //搴曢儴娑堟伅 + if (string.IsNullOrEmpty(i_bottomMsg) == false) + { + var btnBottomTip = new NormalViewControl(bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2, 20, false); + btnBottomTip.Y = Application.GetRealHeight(517) - topFrameLayout.Bottom; + btnBottomTip.Gravity = Gravity.CenterHorizontal; + btnBottomTip.TextAlignment = TextAlignment.TopCenter; + btnBottomTip.TextColor = CSS_Color.MainColor; + btnBottomTip.Text = i_bottomMsg; + btnBottomTip.Height = btnBottomTip.GetRealRowCountByText() * Application.GetRealHeight(24); + btnBottomTip.IsMoreLines = true; + bodyFrameLayout.AddChidren(btnBottomTip); + btnBottomTip.ButtonClickEvent += (sender, e) => + { + this.ActionEvent?.Invoke(2, null); + }; + } + + //瀵嗙爜杈撳叆妗� + this.txtPassword = new EditText(); + txtPassword.IsNumberKeyboardType = true; + txtPassword.Height = 1; + bodyFrameLayout.AddChidren(txtPassword); + txtPassword.Foucs = true; + txtPassword.TextChangeEventHandler = (sender, e) => + { + string passwrod = txtPassword.Text.Trim(); + btnErrorMsg.Text = string.Empty; + for (int i = 0; i < 4; i++) + { + if (i < passwrod.Length) + { + //瀹炲績鍥炬爣 + this.listIconContr[i].IsSelected = true; + } + else + { + //绌哄績鍥炬爣 + this.listIconContr[i].IsSelected = false; + } + } + if (passwrod.Length == 4) + { + //鍏抽棴杈撳叆娉� + Application.HideSoftInput(); + + this.ActionEvent?.Invoke(1, passwrod); + } + }; + + bodyFrameLayout.ButtonClickEvent += (sedner, e) => + { + txtPassword.Foucs = true; + }; + btnIcon1.ButtonClickEvent += (sender, e) => { bodyFrameLayout.ButtonClickEvent(null, null); }; + btnIcon2.ButtonClickEvent += (sender, e) => { bodyFrameLayout.ButtonClickEvent(null, null); }; + btnIcon3.ButtonClickEvent += (sender, e) => { bodyFrameLayout.ButtonClickEvent(null, null); }; + btnIcon4.ButtonClickEvent += (sender, e) => { bodyFrameLayout.ButtonClickEvent(null, null); }; + } + + /// <summary> + /// 鍒濆鍖栧浘鏍囨帶浠� + /// </summary> + /// <returns></returns> + private IconViewControl InitIconControl() + { + var btnIcon1 = new IconViewControl(16); + btnIcon1.BorderColor = CSS_Color.FirstLevelTitleColor; + btnIcon1.BorderWidth = (uint)Application.GetRealWidth(1); + btnIcon1.Radius = (uint)Application.GetRealWidth(8); + btnIcon1.BackgroundColor = CSS_Color.MainBackgroundColor; + btnIcon1.SelectedBackgroundColor = CSS_Color.FirstLevelTitleColor; + bodyFrameLayout.AddChidren(btnIcon1); + + //鍔犲叆缂撳瓨 + this.listIconContr.Add(btnIcon1); + + return btnIcon1; + } + + #endregion + + #region 鈻� 鐣岄潰鍏抽棴___________________________ + + /// <summary> + /// 鐣岄潰鍏抽棴 + /// </summary> + public override void CloseFormBefore() + { + base.CloseFormBefore(); + + this.ActionEvent = null; + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 鏄剧ず閿欒娑堟伅 + /// </summary> + /// <param name="i_errorMsg">闇�瑕佹樉绀虹殑閿欒娑堟伅</param> + public void ShowErrorMsg(string i_errorMsg) + { + this.txtPassword.Text = string.Empty; + btnErrorMsg.Text = i_errorMsg; + btnErrorMsg.Height = btnErrorMsg.GetRealRowCountByText() * Application.GetRealHeight(24); + //鍏ㄩ儴寮勬垚绌哄績鍥炬爣 + for (int i = 0; i < this.listIconContr.Count; i++) + { + this.listIconContr[i].IsSelected = false; + } + } + + #endregion + } +} -- Gitblit v1.8.0