From 9c16d3614d9b88c637f967518a329f239fcd3aaf Mon Sep 17 00:00:00 2001
From: lss <316519258@qq.com>
Date: 星期五, 12 六月 2020 09:22:04 +0800
Subject: [PATCH] 2020.06.12

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/PswNumberInputControl.cs |  109 ++++++++++++++++++++++++++++++++----------------------
 1 files changed, 64 insertions(+), 45 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/PswNumberInputControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/PswNumberInputControl.cs
index 91f6b02..e348862 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/PswNumberInputControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/PswNumberInputControl.cs
@@ -5,9 +5,9 @@
 namespace Shared.Phone.UserCenter
 {
     /// <summary>
-    /// 瀵嗙爜杈撳叆鎺т欢(鑷埗鐨勬墜鍔ㄦ寜閿緭鍏ョ被鍨�,璇峰疄鐜般�怉ctionPswFinish銆戜簨浠�)
+    /// 鏁板瓧鎸夐敭瀵嗙爜杈撳叆鎺т欢(鑷埗鐨勬墜鍔ㄦ寜閿緭鍏ョ被鍨�,璇峰疄鐜般�怉ctionPswFinish銆戜簨浠�)
     /// </summary>
-    public class PswNumberInputControl : FrameLayout
+    public class PswNumberInputControl : FrameLayoutBase
     {
         #region 鈻� 鍙橀噺澹版槑___________________________
 
@@ -38,11 +38,23 @@
         /// <summary>
         /// 鏍囬鎺т欢
         /// </summary>
-        private NormalViewControl btnTitle = null;
+        public NormalViewControl btnTitle = null;
         /// <summary>
         /// 閿欒淇℃伅鎻愮ず鎺т欢
         /// </summary>
-        private NormalViewControl btnError = null;
+        public NormalViewControl btnError = null;
+        /// <summary>
+        /// 鏄剧ず瀵嗙爜榛戠偣鐨凢rame(鏈夊彲鑳介渶瑕佽皟鏁村畠鐨勪綅缃�)
+        /// </summary>
+        public FrameLayout framePswIcon = null;
+        /// <summary>
+        /// 鏁板瓧琛ㄧ洏鐨凢rame(鏈夊彲鑳介渶瑕佽皟鏁村畠鐨勪綅缃�)
+        /// </summary>
+        public FrameLayout frameNumberIcon = null;
+        /// <summary>
+        /// 鏁板瓧琛ㄧ洏鎸夐敭鐨勮儗鏅壊
+        /// </summary>
+        public uint NumberIconBackColor = 0xfff5f6fa;
         /// <summary>
         /// 鍒犻櫎鎺т欢
         /// </summary>
@@ -67,10 +79,11 @@
         {
             this.passwordLength = i_passwordLength;
             //鍔犻棿璺�
-            this.Width = Application.GetMinRealAverage(NumberSize * 3 + NumberLeftRightSpace * 2 + 80);
-            this.Height = Application.GetMinRealAverage(NumberSize * 4 + NumberTopButtomSpace * 3) + Application.GetRealHeight(368);
-            this.btnTitle = new NormalViewControl(Application.CurrentWidth, Application.GetRealWidth(63), false);
+            this.Width = this.GetPictrueRealSize(NumberSize * 3 + NumberLeftRightSpace * 2 + 80);
+            this.Height = this.GetPictrueRealSize(NumberSize * 4 + NumberTopButtomSpace * 3) + Application.GetRealHeight(368);
+            this.btnTitle = new NormalViewControl(Application.CurrentWidth, Application.GetRealWidth(75), false);
             btnTitle.Text = i_title;
+            btnTitle.IsBold = true;
         }
 
         /// <summary>
@@ -81,7 +94,7 @@
             //鏍囬
             btnTitle.Width = this.Width;
             btnTitle.TextAlignment = TextAlignment.Center;
-            btnTitle.TextSize = 16;
+            btnTitle.TextSize = 18;
             this.AddChidren(btnTitle);
 
             //鍒濆鍖栧瘑鐮佸浘鏍�
@@ -91,17 +104,16 @@
             this.InitNumberTableControl();
 
             //閿欒淇℃伅鎻愮ず
-            this.btnError = new NormalViewControl(this.Width, Application.GetRealHeight(58), false);
-            btnError.Y = Application.GetRealHeight(224);
+            this.btnError = new NormalViewControl(this.Width, Application.GetRealHeight(60), false);
+            btnError.Y = Application.GetRealHeight(222);
             btnError.TextAlignment = TextAlignment.Center;
             btnError.TextColor = 0xfff75858;
-            btnError.TextSize = 12;
             this.AddChidren(btnError);
 
             //鍒犻櫎鎺т欢
-            this.btnDelete = new NormalViewControl(200, 58, true);
-            btnDelete.X = this.Width - Application.GetRealWidth(200) - Application.GetMinRealAverage(40);
-            btnDelete.Y = this.Height - Application.GetRealHeight(58);
+            this.btnDelete = new NormalViewControl(200, 60, true);
+            btnDelete.X = this.Width - Application.GetRealWidth(200) - this.GetPictrueRealSize(40);
+            btnDelete.Y = this.Height - Application.GetRealHeight(60);
             btnDelete.TextColor = UserCenterColor.Current.TextGrayColor3;
             btnDelete.TextAlignment = TextAlignment.Center;
             btnDelete.TextID = R.MyInternationalizationString.uDelete;
@@ -132,9 +144,9 @@
         private void InitPswIconControl()
         {
             //鍥炬爣澶у皬
-            int iconSize = Application.GetMinRealAverage(36);
+            int iconSize = this.GetPictrueRealSize(36);
             //鍥炬爣闂寸殑闂撮殧
-            int space = Application.GetMinRealAverage(100);
+            int space = this.GetPictrueRealSize(100);
             //璁$畻瀵嗙爜涓暟鏄惁瓒婄晫
             int value = Application.CurrentWidth - iconSize * passwordLength;
             if (passwordLength > 1)
@@ -147,12 +159,12 @@
                 space = value;
             }
 
-            var frameBack = new FrameLayout();
-            frameBack.Height = iconSize;
-            frameBack.Width = iconSize * passwordLength + space * (passwordLength - 1);
-            frameBack.Y = Application.GetRealHeight(149);
-            frameBack.Gravity = Gravity.CenterHorizontal;
-            this.AddChidren(frameBack);
+            this.framePswIcon = new FrameLayout();
+            framePswIcon.Height = iconSize;
+            framePswIcon.Width = iconSize * passwordLength + space * (passwordLength - 1);
+            framePswIcon.Y = Application.GetRealHeight(149);
+            framePswIcon.Gravity = Gravity.CenterHorizontal;
+            this.AddChidren(framePswIcon);
 
             for (int i = 0; i < passwordLength; i++)
             {
@@ -164,7 +176,7 @@
                 {
                     btnIcon.X = listPswIcon[listPswIcon.Count - 1].Right + space;
                 }
-                frameBack.AddChidren(btnIcon);
+                framePswIcon.AddChidren(btnIcon);
                 listPswIcon.Add(btnIcon);
             }
         }
@@ -178,17 +190,17 @@
         /// </summary>
         private void InitNumberTableControl()
         {
-            var frameBack = new FrameLayout();
-            frameBack.Y = Application.GetRealHeight(368);
-            frameBack.Width = this.Width;
-            frameBack.Gravity = Gravity.CenterHorizontal;
-            frameBack.Height = Application.GetMinRealAverage(NumberSize * 4 + NumberTopButtomSpace * 3);
-            this.AddChidren(frameBack);
+            this.frameNumberIcon = new FrameLayout();
+            frameNumberIcon.Y = Application.GetRealHeight(368);
+            frameNumberIcon.Width = this.Width;
+            frameNumberIcon.Gravity = Gravity.CenterHorizontal;
+            frameNumberIcon.Height = this.GetPictrueRealSize(NumberSize * 4 + NumberTopButtomSpace * 3);
+            this.AddChidren(frameNumberIcon);
 
             //鍓嶄竴涓帶浠剁殑鍙冲潗鏍�
             int btnTempRight = 0;
             //闂磋窛
-            int space = Application.GetMinRealAverage(NumberLeftRightSpace);
+            int space = this.GetPictrueRealSize(NumberLeftRightSpace);
             //1鍒�9鐨勬暟瀛楃洏
             for (int i = 1; i <= 9; i++)
             {
@@ -199,8 +211,8 @@
                     btnNum.X = btnTempRight + space;
                 }
 
-                frameBack.AddChidren(btnNum);
-                btnNum.Y = (i - 1) / 3 * (btnNum.Height + Application.GetMinRealAverage(NumberTopButtomSpace));
+                frameNumberIcon.AddChidren(btnNum);
+                btnNum.Y = (i - 1) / 3 * (btnNum.Height + this.GetPictrueRealSize(NumberTopButtomSpace));
                 btnNum.ButtonClickEvent += (sender, e) =>
                 {
                     //鐐瑰嚮鏁板瓧鎸夐敭
@@ -216,11 +228,11 @@
 
             //0鐨勬暟瀛楃洏
             var btnNum0 = this.InitNumberControl();
-            btnNum0.X = Application.GetMinRealAverage(40) + frameBack.GetChildren(0).Height + space;
+            btnNum0.X = this.GetPictrueRealSize(40) + frameNumberIcon.GetChildren(0).Height + space;
             btnNum0.Text = "0";
 
-            frameBack.AddChidren(btnNum0);
-            btnNum0.Y = 3 * (frameBack.GetChildren(0).Height + Application.GetMinRealAverage(NumberTopButtomSpace));
+            frameNumberIcon.AddChidren(btnNum0);
+            btnNum0.Y = 3 * (frameNumberIcon.GetChildren(0).Height + this.GetPictrueRealSize(NumberTopButtomSpace));
             btnNum0.ButtonClickEvent += (sender, e) =>
             {
                 //鐐瑰嚮鏁板瓧鎸夐敭
@@ -234,10 +246,10 @@
         /// <returns></returns>
         private NormalClickButton InitNumberControl()
         {
-            int iconSize = Application.GetMinRealAverage(NumberSize);
+            int iconSize = this.GetPictrueRealSize(NumberSize);
             var btnNum = new NormalClickButton(iconSize, iconSize, false);
-            btnNum.X = Application.GetMinRealAverage(40);
-            btnNum.BackgroundColor = 0xfff5f6fa;
+            btnNum.X = this.GetPictrueRealSize(40);
+            btnNum.BackgroundColor = this.NumberIconBackColor;
             btnNum.clickStatuColor = 0x7e656565;
             btnNum.Radius = (uint)iconSize / 2;
             btnNum.TextColor = UserCenterColor.Current.TextGrayColor3;
@@ -256,14 +268,13 @@
             {
                 return;
             }
+            if (btnError.Visible == true)
+            {
+                btnError.Visible = false;
+            }
             //鐗规晥鏀瑰彉
             listPswIcon[inputPassword.Length].BackgroundColor = 0xff333333;
             inputPassword += strNum;
-            if (inputPassword.Length == 1)
-            {
-                //灏嗘枃瀛椾粠鍙栨秷鍙樻洿涓哄垹闄�
-                btnDelete.TextID = R.MyInternationalizationString.uDelete;
-            }
             //杈撳叆缁撴潫
             if (FinishInputEvent != null && inputPassword.Length == passwordLength)
             {
@@ -310,6 +321,14 @@
                 btnError.Visible = true;
             }
             btnError.Text = i_msg;
+
+            //璁板綍鐨勫瘑鐮�
+            inputPassword = string.Empty;
+            //瀵嗙爜鍥炬爣
+            for (int i = 0; i < listPswIcon.Count; i++)
+            {
+                listPswIcon[i].BackgroundColor = UserCenterColor.Current.Transparent;
+            }
         }
 
         #endregion
@@ -317,7 +336,7 @@
         #region 鈻� 鍙樻洿鍒犻櫎鎸夐挳浣嶇疆___________________
 
         /// <summary>
-        /// 鍙樻洿鍒犻櫎鎸夐挳浣嶇疆(鐖舵帶浠剁殑楂樺害浼氳嚜鍔ㄨ皟鏁�)
+        /// 鍙樻洿鍒犻櫎鎸夐挳浣嶇疆,瀹冩渶鍒濈殑榛樿浣嶇疆鏄湪鏈�搴曢儴(鐖舵帶浠剁殑楂樺害浼氳嚜鍔ㄨ皟鏁�)
         /// </summary>
         /// <param name="XX">X杞�(涓嶅彉鏇磋璁剧疆涓�-1)</param>
         /// <param name="YY">Y杞�(涓嶅彉鏇磋璁剧疆涓�-1)</param>
@@ -345,7 +364,7 @@
             }
 
             //鑷姩璋冩暣楂樺害
-            int minHeight = Application.GetMinRealAverage(NumberSize * 4 + NumberTopButtomSpace * 3) + Application.GetRealHeight(368);
+            int minHeight = this.GetPictrueRealSize(NumberSize * 4 + NumberTopButtomSpace * 3) + Application.GetRealHeight(368);
             int realHeight = this.btnDelete.Bottom;
             if (realHeight < minHeight)
             {

--
Gitblit v1.8.0