From 3272ca5b51e19f7f8a827b0f68400570a547fe60 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 28 四月 2020 15:02:44 +0800
Subject: [PATCH] 2020-04-28-1

---
 ZigbeeApp/Shared/Phone/Login/PhoneEmailForm.cs |  182 +++++++++++++++++++--------------------------
 1 files changed, 77 insertions(+), 105 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Login/PhoneEmailForm.cs b/ZigbeeApp/Shared/Phone/Login/PhoneEmailForm.cs
index 24ca941..0ae4177 100755
--- a/ZigbeeApp/Shared/Phone/Login/PhoneEmailForm.cs
+++ b/ZigbeeApp/Shared/Phone/Login/PhoneEmailForm.cs
@@ -145,18 +145,19 @@
                 TextSize = CommonFormResouce.TextSize
             };
             accountFL.AddChidren(PhoneZoneBtn);
-            PhoneZoneBtn.MouseUpEventHandler += (sender, e) =>
-            {
-                var form = new AreaCodeSelectForm();
-                parFL.AddChidren(form);
-                form.InitForm();
-                form.ShowForm();
-                form.FinishSelectEvent += (code) =>
-                {
-                    (sender as Button).Text = "+" + code;
-                    CommonPage.PhoneZoneStr = code;
-                };
-            };
+            //鐩墠鍙拡瀵�+86
+            //PhoneZoneBtn.MouseUpEventHandler += (sender, e) =>
+            //{
+            //    var form = new AreaCodeSelectForm();
+            //    parFL.AddChidren(form);
+            //    form.InitForm();
+            //    form.ShowForm();
+            //    form.FinishSelectEvent += (code) =>
+            //    {
+            //        (sender as Button).Text = "+" + code;
+            //        CommonPage.PhoneZoneStr = code;
+            //    };
+            //};
 
             AccountET = new EditText()
             {
@@ -226,16 +227,13 @@
         /// <param name="frameLayout"></param>
         /// <param name="account"></param>
         public void Init(FrameLayout frameLayout, FrameLayout parFL, string account, int x, int y)
-        {
-            var accountFL = new FrameLayout()
-            {
-                X = Application.GetRealWidth(x),
-                Y = Application.GetRealHeight(y),
-                Width = Application.GetRealWidth(CommonFormResouce.Row_Width),
-                Height = Application.GetRealHeight(CommonFormResouce.Row_Height),
-                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
-            };
-            frameLayout.AddChidren(accountFL);
+        {
+            this.X = Application.GetRealWidth(x);
+            this.Y = Application.GetRealHeight(y);
+            this.Width = Application.GetRealWidth(CommonFormResouce.Row_Width);
+            this.Height = Application.GetRealHeight(CommonFormResouce.Row_Height);
+            this.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
+            frameLayout.AddChidren(this);
 
             var accountBtn = new Button()
             {
@@ -245,7 +243,7 @@
                 Gravity = Gravity.CenterVertical,
                 UnSelectedImagePath = "Account/Account.png"
             };
-            accountFL.AddChidren(accountBtn);
+            this.AddChidren(accountBtn);
 
             AccountET = new EditText()
             {
@@ -258,9 +256,10 @@
                 TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                 Text = account,
                 TextAlignment = TextAlignment.CenterLeft,
-                TextSize = CommonFormResouce.PlaceHolderTextSize
+                TextSize = CommonFormResouce.PlaceHolderTextSize,
+                IsNumberKeyboardType = true
             };
-            accountFL.AddChidren(AccountET);
+            this.AddChidren(AccountET);
 
             accountLine = new Button()
             {
@@ -269,7 +268,7 @@
                 Height = 1,
                 BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor
             };
-            accountFL.AddChidren(accountLine);
+            this.AddChidren(accountLine);
 
             AccountET.FoucsChanged += Text_FoucesChangeEvent;
 
@@ -407,16 +406,13 @@
         /// <param name="frameLayout"></param>
         /// <param name="account"></param>
         public void Init(FrameLayout frameLayout, string account, int x, int y)
-        {
-            var accountFL = new FrameLayout()
-            {
-                X = Application.GetRealWidth(x),
-                Y = Application.GetRealHeight(y),
-                Width = Application.GetRealWidth(CommonFormResouce.Row_Width),
-                Height = Application.GetRealHeight(CommonFormResouce.Row_Height),
-                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
-            };
-            frameLayout.AddChidren(accountFL);
+        {
+            this.X = Application.GetRealWidth(x);
+            this.Y = Application.GetRealHeight(y);
+            this.Width = Application.GetRealWidth(CommonFormResouce.Row_Width);
+            this.Height = Application.GetRealHeight(CommonFormResouce.Row_Height);
+            this.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
+            frameLayout.AddChidren(this);
 
             var accountBtn = new Button()
             {
@@ -426,11 +422,11 @@
                 Gravity = Gravity.CenterVertical,
                 UnSelectedImagePath = "Account/Account.png"
             };
-            accountFL.AddChidren(accountBtn);
+            this.AddChidren(accountBtn);
 
             AccountET = new EditText()
             {
-                X = Application.GetRealWidth(222),
+                X = Application.GetRealWidth(193),
                 Width = Application.GetRealWidth(700),
                 Height = Application.GetRealHeight(Button_Height),
                 Gravity = Gravity.CenterVertical,
@@ -441,7 +437,7 @@
                 TextAlignment = TextAlignment.CenterLeft,
                 TextSize = CommonFormResouce.PlaceHolderTextSize
             };
-            accountFL.AddChidren(AccountET);
+            this.AddChidren(AccountET);
 
             accountLine = new Button()
             {
@@ -450,7 +446,7 @@
                 Height = 1,
                 BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor
             };
-            accountFL.AddChidren(accountLine);
+            this.AddChidren(accountLine);
 
             AccountET.FoucsChanged += Text_FoucesChangeEvent;
         }
@@ -828,16 +824,13 @@
         /// <param name="x"></param>
         /// <param name="y"></param>
         public void Init(FrameLayout frameLayout, int x, int y, string password = "")
-        {
-            var pwdFL = new FrameLayout()
-            {
-                X = Application.GetRealWidth(x),
-                Y = Application.GetRealHeight(y),
-                Width = Application.GetRealWidth(CommonFormResouce.Row_Width),
-                Height = Application.GetRealHeight(CommonFormResouce.Row_Height),
-                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
-            };
-            frameLayout.AddChidren(pwdFL);
+        {
+            this.X = Application.GetRealWidth(x);
+            this.Y = Application.GetRealHeight(y);
+            this.Width = Application.GetRealWidth(CommonFormResouce.Row_Width);
+            this.Height = Application.GetRealHeight(CommonFormResouce.Row_Height);
+            this.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
+            frameLayout.AddChidren(this);
 
             var passwordBtn = new Button()
             {
@@ -847,7 +840,7 @@
                 Gravity = Gravity.CenterVertical,
                 UnSelectedImagePath = "Account/Password.png"
             };
-            pwdFL.AddChidren(passwordBtn);
+            this.AddChidren(passwordBtn);
 
             PasswrodET = new EditText()
             {
@@ -863,7 +856,7 @@
                 TextSize = CommonFormResouce.PlaceHolderTextSize,
                 SecureTextEntry = true
             };
-            pwdFL.AddChidren(PasswrodET);
+            this.AddChidren(PasswrodET);
 
             hidenPWDbtn = new Button()
             {
@@ -875,7 +868,7 @@
                 UnSelectedImagePath = "Account/UnhidePwd.png",
                 IsSelected = true
             };
-            pwdFL.AddChidren(hidenPWDbtn);
+            this.AddChidren(hidenPWDbtn);
 
             hidenPWDbtn.MouseUpEventHandler += (sender, e) =>
             {
@@ -890,7 +883,7 @@
                 Height = 1,
                 BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor
             };
-            pwdFL.AddChidren(pwdLine);
+            this.AddChidren(pwdLine);
 
             PasswrodET.FoucsChanged += Text_FoucesChangeEvent;
         }
@@ -1049,7 +1042,7 @@
         /// <summary>
         /// sendCode
         /// </summary>
-        public Button SendCodeBtn;
+        public NormalViewControl SendCodeBtn;
         /// <summary>
         /// VerificationCodeET
         /// </summary>
@@ -1112,20 +1105,15 @@
             };
             codeFL.AddChidren(VerificationCodeET);
 
-            SendCodeBtn = new Button()
+            SendCodeBtn = new NormalViewControl(300, 127, true)
             {
                 X = Application.GetRealWidth(CommonFormResouce.Row_Width - 300),
-                Width = Application.GetRealWidth(300),
-                Height = Application.GetRealHeight(127),
                 Gravity = Gravity.CenterVertical,
                 TextID = R.MyInternationalizationString.SendVerificationCode,
                 TextColor = ZigbeeColor.Current.GXCTextWhiteColor,
-                SelectedTextColor = ZigbeeColor.Current.GXCTextWhiteColor,
                 TextAlignment = TextAlignment.Center,
-                BackgroundColor = ZigbeeColor.Current.GXCButtonDisableColor,
-                SelectedBackgroundColor=ZigbeeColor.Current.GXCButtonSelectedColor,
-                Enable = false,
-                IsSelected = false,
+                BackgroundColor = 0xFFFEBCA9,
+                CanClick = false,
                 Radius=(uint)Application.GetRealHeight(12),
                 IsBold=true,
                 TextSize=CommonFormResouce.TextSize
@@ -1165,51 +1153,35 @@
         }
 
         /// <summary>
-        /// TimeOut
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void TimeOut(object sender, System.Timers.ElapsedEventArgs e)
-        {
-            var span = DateTime.Now - dateBegin;
-            if (span.TotalSeconds <= 61)
-            {
-                Application.RunOnMainThread(() =>
-                {
-                    SendCodeBtn.Text = Convert.ToInt16(60 - span.TotalSeconds) + "s" + Language.StringByID(R.MyInternationalizationString.SendVerificationCodeAgain);
-                    SendCodeBtn.Enable = SendCodeBtn.IsSelected = false;
-                    SendCodeBtn.BackgroundColor = ZigbeeColor.Current.GXCClearColor;
-                    SendCodeBtn.SelectedBackgroundColor= ZigbeeColor.Current.GXCClearColor;
-                    SendCodeBtn.TextColor = ZigbeeColor.Current.GXCTextBlackColor;
-                });
-            }
-            else
-            {
-                Application.RunOnMainThread(() =>
-                {
-                    SendCodeBtn.TextID = R.MyInternationalizationString.SendVerificationCode;
-                    SendCodeBtn.BackgroundColor = ZigbeeColor.Current.GXCButtonDisableColor;
-                    SendCodeBtn.SelectedBackgroundColor = ZigbeeColor.Current.GXCButtonSelectedColor;
-                    SendCodeBtn.TextColor = ZigbeeColor.Current.GXCTextWhiteColor;
-                    SendCodeBtn.Enable = SendCodeBtn.IsSelected = true;
-                    t.Stop();
-                    t.Close();
-                });
-            }
-        }
-
-        /// <summary>
         /// TimeBegin
         /// </summary>
         public void TimeBegin()
-        {
-            t.Interval = 1000;
-            t.AutoReset = true;
-            t.Enabled = true;
-            t.Elapsed += TimeOut;
-            //鍚姩璁℃椂鍣ㄥ�掕鏃�-60s
-            t.Start();
-            dateBegin = DateTime.Now;
+        {
+            SendCodeBtn.BackgroundColor = UserCenterColor.Current.White;
+            SendCodeBtn.TextColor = ZigbeeColor.Current.GXCTextBlackColor;
+
+            HdlThreadLogic.Current.RunThread(() =>
+            {
+                //鍚庨噸鍙�
+                string txtValue = Language.StringByID(R.MyInternationalizationString.SendVerificationCodeAgain);
+                int timeOut = 60;
+                while (timeOut > 0 && SendCodeBtn.Parent != null)
+                {
+                    HdlThreadLogic.Current.RunMain(() =>
+                    {
+                        SendCodeBtn.Text = timeOut + "s" + txtValue;
+                    });
+                    timeOut--;
+                    System.Threading.Thread.Sleep(1000);
+                }
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    SendCodeBtn.TextID = R.MyInternationalizationString.SendVerificationCode;
+                    SendCodeBtn.BackgroundColor = 0xFFFC744B;
+                    SendCodeBtn.TextColor = ZigbeeColor.Current.GXCTextWhiteColor;
+                    SendCodeBtn.CanClick = true;
+                });
+            });
         }
 
         /// <summary>

--
Gitblit v1.8.0