From 463cf39019aa54e6c1226be4620766a035a0c490 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期二, 14 四月 2020 13:31:07 +0800
Subject: [PATCH] 上传个东西

---
 ZigbeeApp/Shared/Phone/Login/AccountLogin.cs |  633 +++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 477 insertions(+), 156 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Login/AccountLogin.cs b/ZigbeeApp/Shared/Phone/Login/AccountLogin.cs
index 5c33746..88dedda 100755
--- a/ZigbeeApp/Shared/Phone/Login/AccountLogin.cs
+++ b/ZigbeeApp/Shared/Phone/Login/AccountLogin.cs
@@ -2,7 +2,8 @@
 using Shared.Common;
 using Shared.Phone.UserView;
 using Shared.Phone.Device.CommonForm;
-
+using Shared.Phone.UserCenter;
+
 namespace Shared.Phone.Login
 {
     /// <summary>
@@ -28,9 +29,13 @@
         /// </summary>
         private EmailLoginRowForm emailRow;
         /// <summary>
-        /// pwdRow
+        /// phonePwdRow
         /// </summary>
-        private PwdLoginRowForm pwdRow;
+        private PwdLoginRowForm phonePwdRow;
+        /// <summary>
+        /// emailPwdRow
+        /// </summary>
+        private PwdLoginRowForm emailPwdRow;
 
         /// <summary>
         /// 璐﹀彿瀵嗙爜fl
@@ -57,14 +62,6 @@
         /// </summary>
         private Button registerBtn;
         /// <summary>
-        /// 璐﹀彿
-        /// </summary>
-        private string account;
-        /// <summary>
-        /// 瀵嗙爜
-        /// </summary>
-        private string password;
-        /// <summary>
         /// wechat
         /// </summary>
         private Button wechatBtn;
@@ -72,7 +69,14 @@
         /// qq
         /// </summary>
         private Button qqBtn;
-
+        /// <summary>
+        /// 杈撳叆鐨勭櫥闄嗚处鍙�(閲嶆柊鐧婚檰鏃朵娇鐢�)
+        /// </summary>
+        private string oldInputPhone = string.Empty;
+        /// <summary>
+        /// 杈撳叆鐨勭櫥闄嗚处鍙�(閲嶆柊鐧婚檰鏃朵娇鐢�)
+        /// </summary>
+        private string oldInputEmail = string.Empty;
 
         #endregion
 
@@ -110,7 +114,7 @@
             }
             else
             {
-                LoginViewShow(account, password);
+                LoginViewShow(account);
             }
         }
 
@@ -118,11 +122,12 @@
         /// Logins the view show.
         /// </summary>
         /// <param name="account">Account.</param>
-        /// <param name="password">Password.</param>
-        public void LoginViewShow(string account = "", string password = "")
+        public void LoginViewShow(string account = "")
         {
-            this.account = account;
-            this.password = password;
+            //璁剧疆涓�涓嬪垵濮嬪��
+            if (account.Contains("@") == true) { this.oldInputEmail = account; }
+            else { this.oldInputPhone = account; }
+
             #region midFrameLayout
             midFrameLayout = new FrameLayout()
             {
@@ -229,8 +234,7 @@
                 SelectedBackgroundColor = ZigbeeColor.Current.GXCButtonBlackSelectedColor,
                 BackgroundColor = ZigbeeColor.Current.GXCButtonUnSelectedColor,
                 Radius = (uint)Application.GetRealHeight(127 / 2),
-                Enable = !string.IsNullOrEmpty(pwdRow.PasswrodET?.Text),
-                IsSelected = !string.IsNullOrEmpty(pwdRow.PasswrodET?.Text),
+                Enable = false,
                 IsBold=true
             };
             midFrameLayout.AddChidren(loginBtn);
@@ -286,14 +290,9 @@
 
             BindEvent();
 
-            if (string.IsNullOrEmpty(account) == false && AccountLogic.Instance.CheckEmail(account) == true)
+            if (account.Contains("@") == true)
             {
                 SelectPhoneOrEmail_MouseUpEvent(phoneEmailForm.SelectedEmail, null);
-                this.account = string.Empty;
-            }
-            else
-            {
-                this.account = string.Empty;
             }
         }
 
@@ -336,11 +335,11 @@
         {
             if (phoneEmailForm.SelectedPhone.IsSelected)
             {
-                Login(phoneRow.AccountET.Text.Trim(), pwdRow.PasswrodET.Text.Trim());
+                Login(phoneRow.AccountET.Text.Trim(), phonePwdRow.PasswrodET.Text.Trim());
             }
             else
             {
-                Login(emailRow.AccountET.Text.Trim(), pwdRow.PasswrodET.Text.Trim());
+                Login(emailRow.AccountET.Text.Trim(), emailPwdRow.PasswrodET.Text.Trim());
             }
 
         }
@@ -351,124 +350,126 @@
         /// <param name="accountStr">Account.</param>
         /// <param name="passwordStr">Password.</param>
         private void Login(string accountStr, string passwordStr)
-        {
+        {
             //Application.RunOnMainThread( () =>
             //{
             Action action = async () =>
             {
                 try
                 {
-                    if(CheckAccount(accountStr)==false)
-                    {
-                        return;
-                    }
-
+                    if(CheckAccount(accountStr)==false)
+                    {
+                        return;
+                    }
+
                     CommonPage.Loading.Start(Language.StringByID(R.MyInternationalizationString.Logining));
 
-                    var requestObj = new SendDataToServer.LoginObj
-                    {
-                        Account = accountStr,
-                        Password = passwordStr,
-                        Source = CommonPage.Source,
-                        Company = CommonPage.Company
-                    };
-                    var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
-                    var revertObj = await CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/Login", System.Text.Encoding.UTF8.GetBytes(requestJson));
-                    if (revertObj == null)
-                    {
-                        CommonPage.Instance.FailureToServer();
-                        CommonPage.Loading.Hide();
-                        return;
-                    }
-                    var stateCodeStr = revertObj.StateCode.ToUpper();
-                    //Error 涓嶈兘鐩存帴浠庢湇鍔″櫒鍙栵紝鍙兘鏍规嵁鐘舵�佺爜閫愪竴鍒ゆ柇
-                    if (stateCodeStr == "SUCCESS")
-                    {
-                        if (revertObj.ResponseData == null)
-                        {
-                            return;
-                        }
-
+                    var requestObj = new SendDataToServer.LoginObj
+                    {
+                        Account = accountStr,
+                        Password = passwordStr,
+                        Source = CommonPage.Source,
+                        Company = CommonPage.Company
+                    };
+                    var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
+                    var revertObj = await CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/Login", System.Text.Encoding.UTF8.GetBytes(requestJson));
+                    if (revertObj == null)
+                    {
+                        CommonPage.Instance.FailureToServer();
+                        CommonPage.Loading.Hide();
+                        return;
+                    }
+                    var stateCodeStr = revertObj.StateCode.ToUpper();
+                    //Error 涓嶈兘鐩存帴浠庢湇鍔″櫒鍙栵紝鍙兘鏍规嵁鐘舵�佺爜閫愪竴鍒ゆ柇
+                    if (stateCodeStr == "SUCCESS")
+                    {
+                        if (revertObj.ResponseData == null)
+                        {
+                            return;
+                        }
+
                         HomePage.Instance.ShowLoginLoadView();
 
-                        new System.Threading.Thread(async () =>
-                        {
-                            //瀛樺偍鏁版嵁
-                            var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(revertObj.ResponseData.ToString());
-                            var revertData = responseDataObj;
-                            Config.ReFresh();
-                            Config.Instance.Account = revertData.Account;
+                        new System.Threading.Thread(async () =>
+                        {
+                            //瀛樺偍鏁版嵁
+                            var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(revertObj.ResponseData.ToString());
+                            var revertData = responseDataObj;
+                            Config.ReFresh();
+                            //鏍囪涓婁竴娆℃槸涓嶆槸鍚屼竴涓处鍙风櫥闄�
+                            UserCenter.UserCenterResourse.ResidenceOption.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid;
+                            Config.Instance.Account = revertData.Account;
                             Config.Instance.Password = passwordStr;
                             Config.Instance.MD5PWD = revertData.MD5PWD;
-                            Config.Instance.Guid = revertData.Guid;
-                            Config.Instance.LoginDateTime = DateTime.Now;
-                            Config.Instance.LoginToken = revertData.Token;
-                            if (Config.Instance.AccountList.Find((obj) => obj == revertData.Account) == null)
-                            {
-                                Config.Instance.AccountList.Add(revertData.Account);
-                            }
-                            Config.Instance.Save();
-
-                            var resultRegID = await Shared.Common.CommonPage.Instance.PushRegID();
-                            var homes = await House.GetHomeLists();
-                            //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼
+                            Config.Instance.Guid = revertData.Guid;
+                            Config.Instance.LoginDateTime = DateTime.Now;
+                            Config.Instance.LoginToken = revertData.Token;
+                            if (Config.Instance.AccountList.Find((obj) => obj == revertData.Account) == null)
+                            {
+                                Config.Instance.AccountList.Add(revertData.Account);
+                            }
+                            Config.Instance.Save();
+
+                            var resultRegID = await Shared.Common.CommonPage.Instance.PushRegID();
+                            var homes = await House.GetHomeLists();
+                            //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼
                             await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread();
                             //鍚姩ZigBee
-                            ZigBee.Common.Application.Init();
-
-                            UserCenter.HdlRoomLogic.Current.InitAllRoom();
-                            Application.RunOnMainThread(() =>
-                            {
-                                CommonPage.Loading.Hide();
-                                this.RemoveFromParent();
+                            ZigBee.Common.Application.Init();
+
+                            UserCenter.HdlRoomLogic.Current.InitAllRoom();
+                            Application.RunOnMainThread(() =>
+                            {
+                                CommonPage.Loading.Hide();
+                                this.RemoveFromParent();
                                 CommonPage.Instance.RemoveViewByTag("Login");
-                                UserPage.Instance.Fresh();
-                            });
-                        })
-                        { IsBackground = true }.Start();
+                                UserPage.Instance.Fresh();
+                            });
+                        })
+                        { IsBackground = true }.Start();
+                    }
+                    else if (stateCodeStr == "NOTVERIFY")
+                    {
+                        CommonPage.Loading.Hide();
+                        //鏈縺娲�
+                        loginErrorBtn.TextID = R.MyInternationalizationString.NOTVERIFY;
+                    }
+                    else if (stateCodeStr == "NOTENABLE")
+                    {
+                        CommonPage.Loading.Hide();
+                        //璇ョ敤鎴峰睘浜庤皟璇曡处鍙凤紝骞舵湭鍚敤
+                        loginErrorBtn.TextID = R.MyInternationalizationString.NOTENABLE;
+                    }
+                    else if (stateCodeStr == "USERNAMEORPWDERROR")
+                    {
+                        CommonPage.Loading.Hide();
+                        //璐﹀彿鎴栧瘑鐮侀敊璇�
+                        loginErrorBtn.TextID = R.MyInternationalizationString.USERNAMEORPWDERROR;
+                    }
+                    else if (stateCodeStr == "ACCOUNTNOEXISTS")
+                    {
+                        CommonPage.Loading.Hide();
+                        //璐﹀彿涓嶅瓨鍦�
+                        loginErrorBtn.TextID = R.MyInternationalizationString.ACCOUNTNOEXISTS;
+                    }
+                    else if (stateCodeStr == "YOUDATANOISLOCALREGION")
+                    {
+                        CommonPage.Loading.Hide();
+                        //涓嶅湪鏈尯鍩燂紝闇�瑕侀噸瀹氬悜鍖哄煙鍚庡啀娆¤姹傜櫥褰�
+                        if (revertObj.ResponseData == null)
+                        {
+                            return;
+                        }
+                        var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginLocalRegionRes>(revertObj.ResponseData.ToString());
+                        CommonPage.RequestHttpsHost = responseDataObj.RegionServer;
+                        //鍐嶆鐧诲綍
+                        Login(accountStr, passwordStr);
+                    }
+                    else
+                    {
+                        loginErrorBtn.TextID = R.MyInternationalizationString.RequestServerFailed;
                     }
-                    else if (stateCodeStr == "NOTVERIFY")
-                    {
-                        CommonPage.Loading.Hide();
-                        //鏈縺娲�
-                        loginErrorBtn.TextID = R.MyInternationalizationString.NOTVERIFY;
-                    }
-                    else if (stateCodeStr == "NOTENABLE")
-                    {
-                        CommonPage.Loading.Hide();
-                        //璇ョ敤鎴峰睘浜庤皟璇曡处鍙凤紝骞舵湭鍚敤
-                        loginErrorBtn.TextID = R.MyInternationalizationString.NOTENABLE;
-                    }
-                    else if (stateCodeStr == "USERNAMEORPWDERROR")
-                    {
-                        CommonPage.Loading.Hide();
-                        //璐﹀彿鎴栧瘑鐮侀敊璇�
-                        loginErrorBtn.TextID = R.MyInternationalizationString.USERNAMEORPWDERROR;
-                    }
-                    else if (stateCodeStr == "ACCOUNTNOEXISTS")
-                    {
-                        CommonPage.Loading.Hide();
-                        //璐﹀彿涓嶅瓨鍦�
-                        loginErrorBtn.TextID = R.MyInternationalizationString.ACCOUNTNOEXISTS;
-                    }
-                    else if (stateCodeStr == "YOUDATANOISLOCALREGION")
-                    {
-                        CommonPage.Loading.Hide();
-                        //涓嶅湪鏈尯鍩燂紝闇�瑕侀噸瀹氬悜鍖哄煙鍚庡啀娆¤姹傜櫥褰�
-                        if (revertObj.ResponseData == null)
-                        {
-                            return;
-                        }
-                        var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginLocalRegionRes>(revertObj.ResponseData.ToString());
-                        CommonPage.RequestHttpsHost = responseDataObj.RegionServer;
-                        //鍐嶆鐧诲綍
-                        Login(accountStr, passwordStr);
-                    }
-                    else
-                    {
-                        loginErrorBtn.TextID = R.MyInternationalizationString.RequestServerFailed;
-                    }
-                }
+                }
                 catch (Exception ex)
                 {
                     System.Console.WriteLine($"鐧诲綍澶辫触--{ex.Message}");
@@ -550,14 +551,14 @@
                         else
                         {
                             new System.Threading.Thread(async () =>
-                            {
+                            {
                                 var re = await isBindAuthAsync(authStr);
                                 if (re)
                                 {
-                                    Application.RunOnMainThread(() =>
+                                    Application.RunOnMainThread(() =>
                                     {
                                         //鐩存帴鐧诲綍
-                                        HomePage.Instance.ShowLoginLoadView();
+                                        HomePage.Instance.ShowLoginLoadView();
                                     });
                                     var resultRegID = await Shared.Common.CommonPage.Instance.PushRegID();
                                     var homes = await House.GetHomeLists();
@@ -618,7 +619,7 @@
                             ZigBee.Common.Application.Init();
                             //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼
                             await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread();
-                            Shared.Common.Room.InitAllRoom();
+                            UserCenter.HdlRoomLogic.Current.InitAllRoom();
                             Application.RunOnMainThread(() =>
                             {
                                 this.RemoveFromParent();
@@ -692,7 +693,9 @@
             if (stateCodeStr == "SUCCESS")
             {
                 var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(revertObj.ResponseData.ToString());
-                var revertData = responseDataObj;
+                var revertData = responseDataObj;
+                //鏍囪涓婁竴娆℃槸涓嶆槸鍚屼竴涓处鍙风櫥闄�
+                UserCenter.UserCenterResourse.ResidenceOption.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid;
                 Config.Instance.Account = revertData.Account;
                 Config.Instance.MD5PWD = revertData.MD5PWD;
                 Config.Instance.Guid = revertData.Guid;
@@ -738,24 +741,56 @@
         /// <param name="phoneOrEmail"></param>
         private void AddPhoneOrEmailFL(FrameLayout accountPwdFrameLayout,string phoneOrEmail)
         {
-            accountPwdFrameLayout.RemoveAll();
-
             if (phoneOrEmail == "Phone")
             {
+                if (phoneRow != null) 
+                {
+                    phoneRow.Visible = true;
+                    phonePwdRow.Visible = true;
+                    if (emailRow != null)
+                    { 
+                        emailRow.Visible = false;
+                        emailPwdRow.Visible = false;
+                    }
+                    this.Pwd_TextChange(phonePwdRow);
+                    return;
+                }
                 phoneRow = new PhoneLoginRowForm();
-                phoneRow.Init(accountPwdFrameLayout, this, this.account, 29, 29);
-                phoneRow.AccountET.TextChangeEventHandler += Account_TextChange;
+                phoneRow.Init(accountPwdFrameLayout, this, this.oldInputPhone, 29, 29);
+                phoneRow.AccountET.TextChangeEventHandler += Account_TextChange;
+
+                phonePwdRow = new PwdLoginRowForm();
+                phonePwdRow.Init(accountPwdFrameLayout, 29, 225);
+                phonePwdRow.PasswrodET.TextChangeEventHandler += (sender, e) =>
+                {
+                    this.Pwd_TextChange(phonePwdRow);
+                };
             }
             else
             {
+                if (emailRow != null)
+                {
+                    emailRow.Visible = true;
+                    emailPwdRow.Visible = true;
+                    if (phoneRow != null) 
+                    { 
+                        phoneRow.Visible = false;
+                        phonePwdRow.Visible = false;
+                    }
+                    this.Pwd_TextChange(emailPwdRow);
+                    return;
+                }
                 emailRow = new EmailLoginRowForm();
-                emailRow.Init(accountPwdFrameLayout, this.account, 29, 29);
-                emailRow.AccountET.TextChangeEventHandler += Account_TextChange;
+                emailRow.Init(accountPwdFrameLayout, this.oldInputEmail, 29, 29);
+                emailRow.AccountET.TextChangeEventHandler += Account_TextChange;
+
+                emailPwdRow = new PwdLoginRowForm();
+                emailPwdRow.Init(accountPwdFrameLayout, 29, 225);
+                emailPwdRow.PasswrodET.TextChangeEventHandler += (sender, e) =>
+                {
+                    this.Pwd_TextChange(emailPwdRow);
+                };
             }
-
-            pwdRow = new PwdLoginRowForm();
-            pwdRow.Init(accountPwdFrameLayout, 29, 225);
-            pwdRow.PasswrodET.TextChangeEventHandler += Pwd_TextChange;
         }
         #endregion
 
@@ -803,32 +838,318 @@
         /// <summary>
         /// 瀵嗙爜鐩戝惉浜嬩欢
         /// </summary>
-        /// <param name="sender">Sender.</param>
-        /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
-        private void Pwd_TextChange(object sender,string mouseEventArgs)
+        /// <param name="pwdRow">Sender.</param>
+        private void Pwd_TextChange(PwdLoginRowForm pwdRow)
         {
             loginErrorBtn.Text = string.Empty;
-            if (1 <= pwdRow.PasswrodET.Text.Trim().Length && pwdRow.PasswrodET.Text.Trim().Length <= 16 && (phoneRow.AccountET.Text.Trim().Length > 0 || emailRow?.AccountET.Text.Trim().Length>0))
+            string pswText = pwdRow.PasswrodET.Text.Trim();
+            if (1 <= pswText.Length && pswText.Length <= 16 && (phoneRow.AccountET.Text.Trim().Length > 0 || emailRow?.AccountET.Text.Trim().Length>0))
             {
                 loginBtn.Enable = loginBtn.IsSelected = true;
             }
-            else if (pwdRow.PasswrodET.Text.Trim().Length > 16)
+            else if (pswText.Length > 16)
             {
-                pwdRow.PasswrodET.Text = mouseEventArgs.Remove(16);
-            }
-            else if (pwdRow.PasswrodET.Text.Trim().Length > 16 && (phoneRow.AccountET.Text.Trim().Length > 0 || emailRow?.AccountET.Text.Trim().Length > 0))
-            {
-                loginBtn.Enable = loginBtn.IsSelected = true;
-                pwdRow.PasswrodET.Text = mouseEventArgs.Remove(16);
+                pwdRow.PasswrodET.Text = pswText.Substring(0, 16);
+                if (phoneRow.AccountET.Text.Trim().Length > 0 || emailRow?.AccountET.Text.Trim().Length > 0)
+                {
+                    loginBtn.Enable = loginBtn.IsSelected = true;
+                }
             }
             else
             {
                 loginBtn.Enable = loginBtn.IsSelected = false;
             }
-        }
+        }
+
+
+        #endregion
+
+
+
+
+        #region 鈻� 鍙橀噺澹版槑___________________________
 
+        /// <summary>
+        /// 鎵嬫満璐﹀彿鐧婚檰鐨勬帶浠跺鍣�
+        /// </summary>
+        private FrameLayout frameAccLoginPhoneback = null;
+        /// <summary>
+        /// 閭璐﹀彿鐧婚檰鐨勬帶浠跺鍣�
+        /// </summary>
+        private FrameLayout frameEmailLoginPhoneback = null;
 
         #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
 
+        /// <summary>
+        /// 鐣岄潰鏄剧ず
+        /// </summary>
+        /// <param name="account">鐧婚檰璐﹀彿</param>
+        public void ShowForm(string account = "")
+        {
+            if (Config.Instance.IsLogin == true)
+            {
+                return;
+            }
+            CommonPage.Instance.IsDrawerLockMode = true;
+            this.Tag = "Login";
+
+            //鐣岄潰涓婇儴鐨勯粦鑹插浘鐗�
+            var btnTopBlackPic = new NormalViewControl(this.Width, Application.GetRealHeight(619), false);
+            btnTopBlackPic.UnSelectedImagePath = "Account/Logo_loginBG.png";
+            this.AddChidren(btnTopBlackPic);
+
+            //涓棿娴呯櫧鑹茬殑鑳屾櫙
+            var frameMidBack = new FrameLayout();
+            frameMidBack.Y = btnTopBlackPic.Bottom;
+            frameMidBack.Height = this.Height - btnTopBlackPic.Bottom;
+            frameMidBack.BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor;
+            this.AddChidren(frameMidBack);
+
+            //HdlHome鐨勫浘鏍�
+            var btnLogoIcon = new PicViewControl(184, 184);
+            btnLogoIcon.Y = Application.GetRealHeight(230);
+            btnLogoIcon.UnSelectedImagePath = "Account/Logo_White.png";
+            btnLogoIcon.Gravity = Gravity.CenterHorizontal;
+            this.AddChidren(btnLogoIcon);
+            //Hdl Home
+            var btnLogoName = new NormalViewControl(300, 69, true);
+            btnLogoName.Y = btnLogoIcon.Bottom;
+            btnLogoName.Gravity = Gravity.CenterHorizontal;
+            btnLogoName.TextID = R.MyInternationalizationString.AppName;
+            btnLogoName.TextColor = ZigbeeColor.Current.GXCTextWhiteColor;
+            btnLogoName.TextSize = 16;
+            this.AddChidren(btnLogoName);
+
+            //鎵嬫満鍙�,閭鐨勮彍鍗曟帶浠�
+            int defultIndex = account.Contains("@") == false ? 1 : 2;
+            var sitchControl = new Controls.PhoneEmailSelectControl();
+            sitchControl.Y = Application.GetRealHeight(559);
+            this.AddChidren(sitchControl);
+            sitchControl.SelectMenuEvent += (selectIndex) =>
+            {
+                //鎵嬫満鍙�
+                if (selectIndex == 1)
+                {
+                }
+                //閭
+                else if (selectIndex == 2)
+                {
+                }
+            };
+            //鎵ц鍒濆鍖�
+            sitchControl.InitControl(ZigbeeColor.Current.GXCButtonSelectedColor, defultIndex);
+
+
+            phoneEmailForm = new PhoneEmailForm();
+            phoneEmailForm.Init(midFrameLayout);
+
+
+            //閿欒鎻愮ずBtn
+            loginErrorBtn = new Button()
+            {
+                X = Application.GetRealWidth(242),
+                Y = Application.GetRealHeight(740),
+                Width = Application.GetRealWidth(700),
+                Height = Application.GetRealHeight(58),
+                TextColor = ZigbeeColor.Current.GXCTextRed,
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize = CommonFormResouce.TextSize,
+                IsBold = true
+            };
+            midFrameLayout.AddChidren(loginErrorBtn);
+
+            accountPwdFL = new FrameLayout()
+            {
+                Y = Application.GetRealHeight(801),
+                Height = Application.GetRealHeight(553),
+                Width = Application.GetRealWidth(942),
+                Gravity = Gravity.CenterHorizontal,
+                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
+                Radius = (uint)Application.GetRealHeight(17)
+            };
+            midFrameLayout.AddChidren(accountPwdFL);
+
+            AddPhoneOrEmailFL(accountPwdFL, "Phone");
+
+            forgotPasswordBtn = new Button()
+            {
+                X = Application.GetRealWidth(CommonPage.AppRealWidth - 115 - 250),
+                Y = Application.GetRealHeight(1198),
+                Width = Application.GetRealWidth(250),
+                Height = Application.GetRealHeight(58),
+                TextID = R.MyInternationalizationString.ForgotPWD_1,
+                TextSize = CommonFormResouce.loginTextSize,
+                TextColor = Shared.Common.ZigbeeColor.Current.GXCTextGrayColor,
+                TextAlignment = TextAlignment.CenterRight
+            };
+            midFrameLayout.AddChidren(forgotPasswordBtn);
+
+            loginBtn = new Button()
+            {
+                Y = Application.GetRealHeight(1293),
+                Width = Application.GetRealWidth(688),
+                Height = Application.GetRealHeight(127),
+                Gravity = Gravity.CenterHorizontal,
+                TextID = R.MyInternationalizationString.Login,
+                TextSize = 16,
+                TextColor = ZigbeeColor.Current.GXCTextGrayColor,
+                SelectedTextColor = ZigbeeColor.Current.GXCTextWhiteColor,
+                SelectedBackgroundColor = ZigbeeColor.Current.GXCButtonBlackSelectedColor,
+                BackgroundColor = ZigbeeColor.Current.GXCButtonUnSelectedColor,
+                Radius = (uint)Application.GetRealHeight(127 / 2),
+                Enable = false,
+                IsBold = true
+            };
+            midFrameLayout.AddChidren(loginBtn);
+
+            loginByCodeBtn = new Button()
+            {
+                X = Application.GetRealWidth(98),
+                Y = Application.GetRealHeight(1466),
+                Width = Application.GetRealWidth(300),
+                Height = Application.GetRealHeight(49),
+                TextID = R.MyInternationalizationString.LoginByCode,
+                TextColor = ZigbeeColor.Current.GXCTextGrayColor,
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize = CommonFormResouce.loginTextSize
+            };
+            midFrameLayout.AddChidren(loginByCodeBtn);
+
+            registerBtn = new Button()
+            {
+                X = Application.GetRealWidth(738),
+                Y = Application.GetRealHeight(1466),
+                Width = Application.GetRealWidth(244),
+                Height = Application.GetRealHeight(49),
+                TextID = R.MyInternationalizationString.Register,
+                TextColor = ZigbeeColor.Current.GXCTextGrayColor,
+                TextAlignment = TextAlignment.CenterRight,
+                TextSize = CommonFormResouce.loginTextSize
+            };
+            midFrameLayout.AddChidren(registerBtn);
+
+            wechatBtn = new Button
+            {
+                X = Application.GetRealWidth(395),
+                Y = Application.GetRealHeight(1737),
+                Width = Application.GetMinRealAverage(115),
+                Height = Application.GetMinRealAverage(115),
+                UnSelectedImagePath = "Account/Wechat.png",
+                Gravity = Gravity.CenterHorizontal
+            };
+            midFrameLayout.AddChidren(wechatBtn);
+
+            qqBtn = new Button
+            {
+                X = Application.GetRealWidth(567),
+                Y = Application.GetRealHeight(1737),
+                Width = Application.GetMinRealAverage(115),
+                Height = Application.GetMinRealAverage(115),
+                UnSelectedImagePath = "Account/QQ.png"
+            };
+            //midFrameLayout.AddChidren(qqBtn);
+
+            BindEvent();
+
+            if (account.Contains("@") == true)
+            {
+                SelectPhoneOrEmail_MouseUpEvent(phoneEmailForm.SelectedEmail, null);
+            }
+        }
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖栬处鍙风櫥闄嗙獥鍙________________
+
+        /// <summary>
+        /// 鍒濆鍖栬处鍙风櫥闄嗙獥鍙�
+        /// </summary>
+        /// <param name="frameMidBack">涓棿娴呰壊鐨勮儗鏅鍣�</param>
+        /// <param name="i_account">鐧婚檰璐﹀彿</param>
+        /// <param name="i_div">1:鎵嬫満鍙� 2:閭</param>
+        private void InitAccoutLoginWindow(FrameLayout frameMidBack, string i_account, int i_div)
+        {
+            //瀹瑰櫒
+            var frameBack = new FrameLayout();
+            frameBack.Height = Application.GetRealHeight(620);
+            frameBack.Y = Application.GetRealHeight(181);
+            frameMidBack.AddChidren(frameBack);
+            //鐧借壊鑳屾櫙
+            var frameWhiteBack = new FrameLayout();
+            frameWhiteBack.Width = Application.GetRealWidth(942);
+            frameWhiteBack.Height = Application.GetRealHeight(553);
+            frameWhiteBack.BackgroundColor = UserCenterColor.Current.White;
+            frameWhiteBack.Radius = (uint)Application.GetRealHeight(17);
+            frameWhiteBack.Gravity = Gravity.CenterHorizontal;
+            frameBack.AddChidren(frameWhiteBack);
+
+            //璐﹀彿琛�
+            var rowAccount = new FrameLayout();
+            rowAccount.Y = Application.GetRealHeight(29);
+            rowAccount.Width = Application.GetRealWidth(884);
+            rowAccount.Height = Application.GetRealHeight(138);
+            rowAccount.Gravity = Gravity.CenterHorizontal;
+            frameWhiteBack.AddChidren(rowAccount);
+            //璐﹀彿鍥炬爣
+            var btnAccountIcon = new IconViewControl(92);
+            btnAccountIcon.X = Application.GetRealWidth(69);
+            btnAccountIcon.Gravity = Gravity.CenterVertical;
+            btnAccountIcon.UnSelectedImagePath = "Account/Account.png";
+            rowAccount.AddChidren(btnAccountIcon);
+            //璐﹀彿杈撳叆妗�
+            var txtAccount = new TextInputControl(600, 92, true);
+            txtAccount.X = btnAccountIcon.Right + Application.GetRealWidth(35);
+            txtAccount.Gravity = Gravity.CenterVertical;
+            if (i_div == 1)
+            {
+                //鎵嬫満鍙�
+                txtAccount.IsNumberKeyboardType = true;
+                txtAccount.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPhoneNum);
+            }
+            else
+            {
+                //閭
+                txtAccount.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputEmail);
+            }
+            txtAccount.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
+            txtAccount.Text = i_account;
+            rowAccount.AddChidren(txtAccount);
+            //搴曠嚎
+            var btnAccountLine = new NormalViewControl(rowAccount.Width, 1, false);
+            btnAccountLine.BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor;
+            btnAccountLine.Y = rowAccount.Height - 1;
+            rowAccount.AddChidren(btnAccountLine);
+
+            //瀵嗙爜琛�
+            var rowPassword = new FrameLayout();
+            rowPassword.Y = rowAccount.Bottom + Application.GetRealHeight(58);
+            rowPassword.Width = rowAccount.Width;
+            rowPassword.Height = rowAccount.Height;
+            rowPassword.Gravity = Gravity.CenterHorizontal;
+            frameWhiteBack.AddChidren(rowPassword);
+            //璐﹀彿鍥炬爣
+            var btnPswIcon = new IconViewControl(92);
+            btnPswIcon.X = btnAccountIcon.X;
+            btnPswIcon.Gravity = Gravity.CenterVertical;
+            btnPswIcon.UnSelectedImagePath = "Account/Password.png";
+            rowPassword.AddChidren(btnPswIcon);
+            //璐﹀彿杈撳叆妗�
+            var txtPsw = new TextInputControl(600, 92, true);
+            txtPsw.X = txtAccount.X;
+            txtPsw.Gravity = Gravity.CenterVertical;
+            txtPsw.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD);
+            txtPsw.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
+            txtPsw.SecureTextEntry = true;
+            rowPassword.AddChidren(txtPsw);
+            //搴曠嚎
+            var btnPswLine = new NormalViewControl(rowPassword.Width, 1, false);
+            btnPswLine.BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor;
+            btnPswLine.Y = rowPassword.Height - 1;
+            rowPassword.AddChidren(btnPswLine);
+        }
+
+        #endregion
     }
 }

--
Gitblit v1.8.0