陈嘉乐
2020-04-29 38ab16c66df6fc523f2c385fd583a2f2e86a781c
ZigbeeApp/Shared/Phone/Login/AccountLogin.cs
@@ -1,31 +1,31 @@
using System;
using Shared.Common;
using Shared.Phone.UserView;
using Shared.Phone.Device.CommonForm;
using System;
using Shared.Common;
using Shared.Phone.UserView;
using Shared.Phone.Device.CommonForm;
using Shared.Phone.UserCenter;
namespace Shared.Phone.Login
{
    /// <summary>
    /// 登录界面
    /// </summary>
    public class AccountLogin : FrameLayout
namespace Shared.Phone.Login
{
    /// <summary>
    /// 登录界面
    /// </summary>
    public class AccountLogin : FrameLayoutBase
    {
        #region ■ 变量声明___________________________
        #region ■ 变量声明___________________________
        /// <summary>
        /// 错误提示控件
        /// </summary>
        private NormalViewControl btnErrorMsg = null;
        /// </summary>
        private NormalViewControl btnErrorMsg = null;
        /// <summary>
        /// 是否同意隐私协议
        /// </summary>
        private bool isAgreePrivacyPolicy = true;
        #endregion
        /// </summary>
        private bool isAgreePrivacyPolicy = true;
        #region ■ 初始化_____________________________
        #endregion
        #region ■ 初始化_____________________________
        /// <summary>
        /// 界面显示
        /// </summary>
@@ -36,57 +36,57 @@
            {
                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";
            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
            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.TextAlignment = TextAlignment.Center;
            btnLogoName.TextSize = 16;
            btnLogoName.TextSize = 16;
            this.AddChidren(btnLogoName);
            //1:手机号  2:邮箱
            int selectIndex = account.Contains("@") == false ? 1 : 2;
            //初始化 手机账号登陆窗口
            var frameAccLoginPhoneback = this.InitAccoutLoginWindow(frameMidBack, selectIndex == 1 ? account : string.Empty, 1);
            var frameAccLoginPhoneback = this.InitAccoutLoginWindow(frameMidBack, selectIndex == 1 ? account : string.Empty, 1);
            //初始化 邮箱账号登陆窗口
            var frameEmailLoginPhoneback = this.InitAccoutLoginWindow(frameMidBack, selectIndex == 1 ? string.Empty : account, 2);
            //初始化 手机账号验证码登陆窗口
            var frameAccCodeLoginPhoneback = this.InitCodeLoginWindow(frameMidBack, selectIndex == 1 ? account : string.Empty, 1);
            var frameAccCodeLoginPhoneback = this.InitCodeLoginWindow(frameMidBack, selectIndex == 1 ? account : string.Empty, 1);
            //初始化 邮箱账号验证码登陆窗口
            var frameEmailCodeLoginPhoneback = this.InitCodeLoginWindow(frameMidBack, selectIndex == 1 ? string.Empty : account, 2);
            //定义这两个东西,是为了减少判断的代码
            var framePhone = frameAccLoginPhoneback;
            var frameEmail = frameEmailLoginPhoneback;
            //邮箱,手机号的切换控件
            var sitchControl = new Controls.PhoneEmailSelectControl();
            sitchControl.Y = Application.GetRealHeight(559);
            this.AddChidren(sitchControl);
            var frameEmailCodeLoginPhoneback = this.InitCodeLoginWindow(frameMidBack, selectIndex == 1 ? string.Empty : account, 2);
            //定义这两个东西,是为了减少判断的代码
            var framePhone = frameAccLoginPhoneback;
            var frameEmail = frameEmailLoginPhoneback;
            //邮箱,手机号的切换控件
            var sitchControl = new Controls.PhoneEmailSelectControl();
            sitchControl.Y = Application.GetRealHeight(559);
            this.AddChidren(sitchControl);
            sitchControl.SelectMenuEvent += (selectMenu) =>
            {
                selectIndex = selectMenu;
@@ -102,26 +102,26 @@
                    framePhone.Visible = false;
                    frameEmail.Visible = true;
                }
            };
            //执行初始化
            sitchControl.InitControl(ZigbeeColor.Current.GXCButtonSelectedColor, selectIndex);
            //错误提示控件
            this.btnErrorMsg = new NormalViewControl(700, 60, true);
            btnErrorMsg.Y = frameAccLoginPhoneback.Y - Application.GetRealHeight(60 + 3);
            btnErrorMsg.X = Application.GetRealWidth(288);
            btnErrorMsg.TextColor = ZigbeeColor.Current.GXCTextRed;
            btnErrorMsg.IsBold = true;
            };
            //执行初始化
            sitchControl.InitControl(ZigbeeColor.Current.GXCButtonSelectedColor, selectIndex);
            //错误提示控件
            this.btnErrorMsg = new NormalViewControl(700, 60, true);
            btnErrorMsg.Y = frameAccLoginPhoneback.Y - Application.GetRealHeight(60 + 3);
            btnErrorMsg.X = Application.GetRealWidth(288);
            btnErrorMsg.TextColor = ZigbeeColor.Current.GXCTextRed;
            btnErrorMsg.IsBold = true;
            frameMidBack.AddChidren(btnErrorMsg);
            //验证码登陆
            //1:账号登陆  2:验证码登陆
            int codeDiv = 1;
            var btnLoginByCode = new NormalViewControl(300, 100, true);
            var btnLoginByCode = new NormalViewControl(300, 100, true);
            btnLoginByCode.X = Application.GetRealWidth(98);
            btnLoginByCode.Y = frameAccLoginPhoneback.Bottom + Application.GetRealHeight(21);
            btnLoginByCode.TextID = R.MyInternationalizationString.LoginByCode;
            btnLoginByCode.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnLoginByCode.Y = frameAccLoginPhoneback.Bottom + Application.GetRealHeight(21);
            btnLoginByCode.TextID = R.MyInternationalizationString.LoginByCode;
            btnLoginByCode.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnLoginByCode.TextSize = 12;
            frameMidBack.AddChidren(btnLoginByCode);
            btnLoginByCode.ButtonClickEvent += (sender, e) =>
@@ -155,12 +155,12 @@
            };
            //注册用户
            var btnRegister = new NormalViewControl(300, 100, true);
            btnRegister.Y = btnLoginByCode.Y;
            btnRegister.X = frameMidBack.Width - Application.GetRealWidth(98 + 300);
            btnRegister.TextID = R.MyInternationalizationString.Register;
            btnRegister.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnRegister.TextSize = 12;
            var btnRegister = new NormalViewControl(300, 100, true);
            btnRegister.Y = btnLoginByCode.Y;
            btnRegister.X = frameMidBack.Width - Application.GetRealWidth(98 + 300);
            btnRegister.TextID = R.MyInternationalizationString.Register;
            btnRegister.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnRegister.TextSize = 12;
            btnRegister.TextAlignment = TextAlignment.CenterRight;
            frameMidBack.AddChidren(btnRegister);
            btnRegister.ButtonClickEvent += (sender, e) =>
@@ -171,9 +171,9 @@
            };
            //微信图标
            var btnWebChat = new IconViewControl(115);
            btnWebChat.Y = frameMidBack.Height - Application.GetRealHeight(69) - btnWebChat.IconSize;
            btnWebChat.UnSelectedImagePath = "Account/Wechat.png";
            var btnWebChat = new IconViewControl(115);
            btnWebChat.Y = frameMidBack.Height - Application.GetRealHeight(69) - btnWebChat.IconSize;
            btnWebChat.UnSelectedImagePath = "Account/Wechat.png";
            btnWebChat.Gravity = Gravity.CenterHorizontal;
            frameMidBack.AddChidren(btnWebChat);
            btnWebChat.ButtonClickEvent += (sender, e) =>
@@ -189,7 +189,7 @@
            var btnTiyan = new NormalViewControl(300, 100, true);
            btnTiyan.Y = btnLoginByCode.Y;
            btnTiyan.TextAlignment = TextAlignment.Center;
            btnTiyan.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnTiyan.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnTiyan.TextSize = 12;
            btnTiyan.Gravity = Gravity.CenterHorizontal;
            btnTiyan.Text = "游客体验";
@@ -213,16 +213,16 @@
            };
        }
        #endregion
        #endregion
        #region ■ 初始化账号登陆窗口_________________
        #region ■ 初始化账号登陆窗口_________________
        /// <summary>
        /// 初始化账号登陆窗口
        /// </summary>
        /// <param name="frameMidBack">中间浅色的背景容器</param>
        /// <param name="i_account">登陆账号</param>
        /// <param name="i_div">1:手机号 2:邮箱</param>
        /// <param name="i_div">1:手机号 2:邮箱</param>
        private FrameLayout InitAccoutLoginWindow(FrameLayout frameMidBack, string i_account, int i_div)
        {
            //登陆按钮
@@ -339,9 +339,9 @@
            //隐藏或者显示密码的图标
            var btnHiden = new IconViewControl(92);
            btnHiden.X = rowPassword.Width - Application.GetRealWidth(46) - btnHiden.IconSize;
            btnHiden.SelectedImagePath = "Account/UnhidePwd.png";
            btnHiden.SelectedImagePath = "Account/UnhidePwd.png";
            btnHiden.UnSelectedImagePath = "Account/HidePwd.png";
            btnHiden.Gravity = Gravity.CenterVertical;
            btnHiden.Gravity = Gravity.CenterVertical;
            rowPassword.AddChidren(btnHiden);
            btnHiden.ButtonClickEvent += (sender, e) =>
            {
@@ -370,13 +370,13 @@
            };
            //忘记密码?
            var btnForgot = new NormalViewControl(250, 90, true);
            btnForgot.Y = rowPassword.Bottom + Application.GetRealHeight(15);
            btnForgot.X = frameWhiteBack.Width - Application.GetRealWidth(250 + 35);
            btnForgot.TextSize = 12;
            btnForgot.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnForgot.TextAlignment = TextAlignment.CenterRight;
            btnForgot.TextID = R.MyInternationalizationString.ForgotPWD_1;
            var btnForgot = new NormalViewControl(250, 90, true);
            btnForgot.Y = rowPassword.Bottom + Application.GetRealHeight(15);
            btnForgot.X = frameWhiteBack.Width - Application.GetRealWidth(250 + 35);
            btnForgot.TextSize = 12;
            btnForgot.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnForgot.TextAlignment = TextAlignment.CenterRight;
            btnForgot.TextID = R.MyInternationalizationString.ForgotPWD_1;
            frameWhiteBack.AddChidren(btnForgot);
            btnForgot.ButtonClickEvent += (sender, e) =>
            {
@@ -401,7 +401,7 @@
            return frameBack;
        }
        #endregion
        #endregion
        #region ■ 初始化验证码登陆窗口_______________
@@ -410,7 +410,7 @@
        /// </summary>
        /// <param name="frameMidBack">中间浅色的背景容器</param>
        /// <param name="i_account">登陆账号</param>
        /// <param name="i_div">1:手机号 2:邮箱</param>
        /// <param name="i_div">1:手机号 2:邮箱</param>
        private FrameLayout InitCodeLoginWindow(FrameLayout frameMidBack, string i_account, int i_div)
        {
            //登陆按钮
@@ -542,18 +542,18 @@
                txtAccount.TextChangeEventHandler(sender, e);
            };
            //竖线
            var btnLine2 = new NormalViewControl(1, Application.GetRealHeight(66), false);
            var btnLine2 = new NormalViewControl(1, Application.GetRealHeight(66), false);
            btnLine2.X = Application.GetRealWidth(611);
            btnLine2.Gravity = Gravity.CenterVertical;
            btnLine2.BackgroundColor = ZigbeeColor.Current.GXCLineColor;
            rowVerCode.AddChidren(btnLine2);
            //获取验证码
            var btnSendCode = new NormalViewControl(250, 70, true);
            btnSendCode.X = btnLine2.Right + Application.GetRealWidth(36);
            btnSendCode.Gravity = Gravity.CenterVertical;
            var btnSendCode = new NormalViewControl(250, 70, true);
            btnSendCode.X = btnLine2.Right + Application.GetRealWidth(36);
            btnSendCode.Gravity = Gravity.CenterVertical;
            btnSendCode.TextID = R.MyInternationalizationString.SendVerificationCode;
            btnSendCode.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnSendCode.TextAlignment = TextAlignment.Center;
            btnSendCode.TextAlignment = TextAlignment.Center;
            btnSendCode.IsBold = true;
            rowVerCode.AddChidren(btnSendCode);
            btnSendCode.ButtonClickEvent += async (sender, e) =>
@@ -589,13 +589,13 @@
            };
            //忘记密码?
            var btnForgot = new NormalViewControl(250, 90, true);
            btnForgot.Y = rowVerCode.Bottom + Application.GetRealHeight(15);
            btnForgot.X = frameWhiteBack.Width - Application.GetRealWidth(250 + 35);
            btnForgot.TextSize = 12;
            btnForgot.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnForgot.TextAlignment = TextAlignment.CenterRight;
            btnForgot.TextID = R.MyInternationalizationString.ForgotPWD_1;
            var btnForgot = new NormalViewControl(250, 90, true);
            btnForgot.Y = rowVerCode.Bottom + Application.GetRealHeight(15);
            btnForgot.X = frameWhiteBack.Width - Application.GetRealWidth(250 + 35);
            btnForgot.TextSize = 12;
            btnForgot.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnForgot.TextAlignment = TextAlignment.CenterRight;
            btnForgot.TextID = R.MyInternationalizationString.ForgotPWD_1;
            frameWhiteBack.AddChidren(btnForgot);
            btnForgot.ButtonClickEvent += (sender, e) =>
            {
@@ -619,7 +619,7 @@
            return frameBack;
        }
        #endregion
        #endregion
        #region ■ 服务协议___________________________
@@ -630,7 +630,7 @@
        private void AddServiceAgreementControl(FrameLayout frameBack)
        {
            var frameRow = new FrameLayout();
            frameRow.Height = Application.GetMinRealAverage(110);
            frameRow.Height = this.GetPictrueRealSize(110);
            frameRow.Y = Application.GetRealHeight(959);
            frameRow.Gravity = Gravity.CenterHorizontal;
@@ -708,7 +708,7 @@
            btnIcon.SelectedImagePath = "Item/Check1Selected.png";
            //计算行控件的宽度
            frameRow.Width = fontWidth + Application.GetMinRealAverage(42) + Application.GetRealWidth(23) - speceilValue * 3;
            frameRow.Width = fontWidth + this.GetPictrueRealSize(42) + Application.GetRealWidth(23) - speceilValue * 3;
            frameBack.AddChidren(frameRow);
            //图标控件初始化
@@ -737,14 +737,14 @@
        #endregion
        #region ■ 账号密码登陆_______________________
        #region ■ 账号密码登陆_______________________
        /// <summary>
        /// 账号密码登陆
        /// </summary>
        /// <param name="i_account">账号</param>
        /// <param name="i_psw">密码</param>
        /// <param name="i_div">1:手机号 2:邮箱</param>
        /// <param name="i_psw">密码</param>
        /// <param name="i_div">1:手机号 2:邮箱</param>
        private void LoginByAccountAndPsw(string i_account, string i_psw, int i_div)
        {
            //检测账号
@@ -774,59 +774,59 @@
            });
        }
        /// <summary>
        /// 检测输入的账号
        /// </summary>
        /// <param name="i_areaCode">地区码</param>
        /// <param name="i_account">账号</param>
        /// <param name="i_div">1:手机号 2:邮箱</param>
        /// <returns></returns>
        private bool CheckInputAccount(string i_areaCode, string i_account, int i_div)
        {
        /// <summary>
        /// 检测输入的账号
        /// </summary>
        /// <param name="i_areaCode">地区码</param>
        /// <param name="i_account">账号</param>
        /// <param name="i_div">1:手机号 2:邮箱</param>
        /// <returns></returns>
        private bool CheckInputAccount(string i_areaCode, string i_account, int i_div)
        {
            if (i_div == 1)
            {
                //检测手机
                if (i_areaCode != string.Empty && AccountLogic.Instance.CheckPhoneWithZone(i_account, i_areaCode) == false)
                {
                    btnErrorMsg.TextID = R.MyInternationalizationString.ThePhoneError;
                    return false;
                if (i_areaCode != string.Empty && AccountLogic.Instance.CheckPhoneWithZone(i_account, i_areaCode) == false)
                {
                    btnErrorMsg.TextID = R.MyInternationalizationString.ThePhoneError;
                    return false;
                }
                //检测手机
                if (i_areaCode == string.Empty && AccountLogic.Instance.CheckPhone(i_account) == false)
                {
                    btnErrorMsg.TextID = R.MyInternationalizationString.ThePhoneError;
                    return false;
                if (i_areaCode == string.Empty && AccountLogic.Instance.CheckPhone(i_account) == false)
                {
                    btnErrorMsg.TextID = R.MyInternationalizationString.ThePhoneError;
                    return false;
                }
            }
            else
            }
            else
            {
                //检测邮箱
                if (AccountLogic.Instance.CheckEmail(i_account) == false)
                {
                    btnErrorMsg.TextID = R.MyInternationalizationString.TheEmailError;
                    return false;
                if (AccountLogic.Instance.CheckEmail(i_account) == false)
                {
                    btnErrorMsg.TextID = R.MyInternationalizationString.TheEmailError;
                    return false;
                }
            }
            return true;
            }
            return true;
        }
        #endregion
        #endregion
        #region ■ 微信登陆___________________________
        #region ■ 微信登陆___________________________
        /// <summary>
        /// 微信登录
        /// </summary>
        private void LoginByWechat()
        /// <summary>
        /// 微信登录
        /// </summary>
        private void LoginByWechat()
        {
#if Android
            com.hdl.home.Application.WXLogin();
            com.hdl.home.WXEntryActivity.RespAction = (authStr) =>
            {
#endif
#if iOS
#if iOS
            Home.IOS.AppDelegate.WXLogin();
            Home.IOS.AppDelegate.RespAction = (authStr) =>
            Home.IOS.AppDelegate.RespAction = (authStr) =>
            {
#endif
                if (authStr == null)
@@ -873,19 +873,19 @@
            };
        }
        /// <summary>
        /// 是否已绑定
        /// </summary>
        /// <param name="authStr"></param>
        /// <returns></returns>
        private async System.Threading.Tasks.Task<bool> isBindAuthAsync(string authStr)
        {
            var authRes = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.AuthUserRes>(authStr);
            var auth = new SendDataToServer.AuthUser()
            {
                AccessToken = authRes.access_token,
                RefreshToken = authRes.refresh_token,
                OpenID = authRes.openid
        /// <summary>
        /// 是否已绑定
        /// </summary>
        /// <param name="authStr"></param>
        /// <returns></returns>
        private async System.Threading.Tasks.Task<bool> isBindAuthAsync(string authStr)
        {
            var authRes = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.AuthUserRes>(authStr);
            var auth = new SendDataToServer.AuthUser()
            {
                AccessToken = authRes.access_token,
                RefreshToken = authRes.refresh_token,
                OpenID = authRes.openid
            };
            //获取微信昵称
            var strUrl = "https://api.weixin.qq.com/sns/userinfo?access_token=" + authRes.access_token;
@@ -897,44 +897,44 @@
            }
            var receipData = System.Text.Encoding.UTF8.GetString(byteData);
            var nickData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserCenter.NicknameInfo>(receipData);
            auth.UserName = nickData.nickname;
            var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(auth);
            var revertObj = await CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/InsertOrUpdateAuthUser", System.Text.Encoding.UTF8.GetBytes(requestJson));
            if (revertObj == null)
            {
                return false;
            }
            var stateCodeStr = revertObj.StateCode.ToUpper();
            if (stateCodeStr == "SUCCESS")
            {
                var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(revertObj.ResponseData.ToString());
            auth.UserName = nickData.nickname;
            var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(auth);
            var revertObj = await CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/InsertOrUpdateAuthUser", System.Text.Encoding.UTF8.GetBytes(requestJson));
            if (revertObj == null)
            {
                return false;
            }
            var stateCodeStr = revertObj.StateCode.ToUpper();
            if (stateCodeStr == "SUCCESS")
            {
                var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(revertObj.ResponseData.ToString());
                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;
                Config.Instance.LoginDateTime = DateTime.Now;
                Config.Instance.Save();
                return true;
            }
            else
            {
                return false;
            }
                UserCenter.UserCenterResourse.ResidenceOption.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid;
                Config.Instance.Account = revertData.Account;
                Config.Instance.MD5PWD = revertData.MD5PWD;
                Config.Instance.Guid = revertData.Guid;
                Config.Instance.LoginDateTime = DateTime.Now;
                Config.Instance.Save();
                return true;
            }
            else
            {
                return false;
            }
        }
        #endregion
        #endregion
        #region ■ 验证码登陆_________________________
        #region ■ 验证码登陆_________________________
        /// <summary>
        /// 验证码登陆
        /// </summary>
        /// <param name="i_account">账号</param>
        /// <param name="i_verCode">验证码</param>
        /// <param name="i_div">1:手机号 2:邮箱</param>
        /// <param name="i_verCode">验证码</param>
        /// <param name="i_div">1:手机号 2:邮箱</param>
        private async void LoginByVerCode(string i_account, string i_verCode, int i_div)
        {
            var pra = new SendDataToServer.LoginValidCodeOBJ()
@@ -947,15 +947,15 @@
            var result = await CommonFormResouce.LoginByCode(pra);
            //处理登陆成功的数据
            this.AdjustLoginSuccessData(result, pra, i_account, string.Empty, i_div);
        }
        }
        /// <summary>
        /// 发送验证码
        /// </summary>
        /// <param name="btnSendCode">发送按钮</param>
        /// <param name="account">账号</param>
        /// <param name="i_div">1:手机号 2:邮箱</param>
        /// <returns></returns>
        /// <returns></returns>
        private async System.Threading.Tasks.Task<bool> SendVerCode(NormalViewControl btnSendCode, string account, int i_div)
        {
            //不能再点击
@@ -1027,12 +1027,12 @@
            });
            return false;
        }
        }
        /// <summary>
        /// 开启发送验证码的倒计时
        /// </summary>
        /// <param name="btnSendCode"></param>
        /// <param name="btnSendCode"></param>
        private void StartSendVerCodeTimeOutThread(NormalViewControl btnSendCode)
        {
            HdlThreadLogic.Current.RunThread(() =>
@@ -1059,9 +1059,9 @@
            });
        }
        #endregion
        #endregion
        #region ■ 处理登陆成功的数据_________________
        #region ■ 处理登陆成功的数据_________________
        /// <summary>
        /// 处理登陆成功的数据
@@ -1069,8 +1069,8 @@
        /// <param name="revertObj">云端返回的数据</param>
        /// <param name="pra">接口请求参数</param>
        /// <param name="i_account">账号</param>
        /// <param name="i_psw">密码,验证码登陆时,设置为 string.Empty</param>
        /// <param name="i_div">1:手机号 2:邮箱</param>
        /// <param name="i_psw">密码,验证码登陆时,设置为 string.Empty</param>
        /// <param name="i_div">1:手机号 2:邮箱</param>
        private async void AdjustLoginSuccessData(Common.ResponseEntity.ResponsePack revertObj, object pra,
            string i_account, string i_psw, int i_div)
        {
@@ -1137,15 +1137,15 @@
                    //该用户属于调试账号,并未启用
                    btnErrorMsg.TextID = R.MyInternationalizationString.NOTENABLE;
                }
                else if (stateCodeStr == "PARAMETEROREMPTY")
                {
                    //提供的参数错误
                    btnErrorMsg.TextID = R.MyInternationalizationString.PARAMETEROREMPTY;
                else if (stateCodeStr == "PARAMETEROREMPTY")
                {
                    //提供的参数错误
                    btnErrorMsg.TextID = R.MyInternationalizationString.PARAMETEROREMPTY;
                }
                else if (stateCodeStr == "VALIDCODEANDPHONENOEQUAL")
                {
                    //验证码错误,请重新输入
                    btnErrorMsg.TextID = R.MyInternationalizationString.VALIDCODEANDPHONENOEQUAL;
                else if (stateCodeStr == "VALIDCODEANDPHONENOEQUAL")
                {
                    //验证码错误,请重新输入
                    btnErrorMsg.TextID = R.MyInternationalizationString.VALIDCODEANDPHONENOEQUAL;
                }
                else if (stateCodeStr == "USERNAMEORPWDERROR")
                {
@@ -1157,10 +1157,10 @@
                    //账号不存在
                    btnErrorMsg.TextID = R.MyInternationalizationString.ACCOUNTNOEXISTS;
                }
                else if (stateCodeStr == "NORECORD" && i_psw == string.Empty)
                {
                    //请先获取验证码
                    btnErrorMsg.TextID = R.MyInternationalizationString.NORECORD;
                else if (stateCodeStr == "NORECORD" && i_psw == string.Empty)
                {
                    //请先获取验证码
                    btnErrorMsg.TextID = R.MyInternationalizationString.NORECORD;
                }
                else if (stateCodeStr == "YOUDATANOISLOCALREGION")
                {
@@ -1190,14 +1190,14 @@
            });
        }
        #endregion
        #endregion
        #region ■ 一般方法___________________________
        #region ■ 一般方法___________________________
        /// <summary>
        /// 检测隐私协议
        /// </summary>
        /// <returns></returns>
        /// <returns></returns>
        private bool CheckPrivacyPolicy()
        {
            if (isAgreePrivacyPolicy == false)
@@ -1208,8 +1208,8 @@
                return false;
            }
            return true;
        }
        #endregion
    }
}
        }
        #endregion
    }
}