WJC
2020-03-23 bba578c2f0acf2eca747edcb69426771e0cadd32
ZigbeeApp/Shared/Phone/Login/AccountLogin.cs
@@ -28,9 +28,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 +61,6 @@
        /// </summary>
        private Button registerBtn;
        /// <summary>
        /// 账号
        /// </summary>
        private string account;
        /// <summary>
        /// 密码
        /// </summary>
        private string password;
        /// <summary>
        /// wechat
        /// </summary>
        private Button wechatBtn;
@@ -72,7 +68,10 @@
        /// qq
        /// </summary>
        private Button qqBtn;
        /// <summary>
        /// 输入的登陆账号(重新登陆时使用)
        /// </summary>
        private string oldInputAccount = string.Empty;
        #endregion
@@ -110,7 +109,7 @@
            }
            else
            {
                LoginViewShow(account, password);
                LoginViewShow(account);
            }
        }
@@ -118,11 +117,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.oldInputAccount = account; }
            else { this.oldInputAccount = account; }
            #region midFrameLayout
            midFrameLayout = new FrameLayout()
            {
@@ -229,8 +229,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 +285,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 +330,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());
            }
        }
@@ -738,24 +732,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.Init(accountPwdFrameLayout, this, this.oldInputAccount, 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
            {
                emailRow = new EmailLoginRowForm();
                emailRow.Init(accountPwdFrameLayout, this.account, 29, 29);
                emailRow.AccountET.TextChangeEventHandler += Account_TextChange;
                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.oldInputAccount, 29, 29);
                emailRow.AccountET.TextChangeEventHandler += Account_TextChange;
            pwdRow = new PwdLoginRowForm();
            pwdRow.Init(accountPwdFrameLayout, 29, 225);
            pwdRow.PasswrodET.TextChangeEventHandler += Pwd_TextChange;
                emailPwdRow = new PwdLoginRowForm();
                emailPwdRow.Init(accountPwdFrameLayout, 29, 225);
                emailPwdRow.PasswrodET.TextChangeEventHandler += (sender, e) =>
                {
                    this.Pwd_TextChange(emailPwdRow);
                };
            }
        }
        #endregion
@@ -803,23 +829,22 @@
        /// <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))
                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;
                pwdRow.PasswrodET.Text = mouseEventArgs.Remove(16);
                }
            }
            else
            {