JLChen
2020-01-12 ac2ee45fadc64fe840bbba6264df3ca4622adb15
Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs
@@ -384,31 +384,31 @@
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="stateCodeStr"></param>
        void ShowGetAllBindGatewarysPaggerErrorInfo (string stateCodeStr)
        {
            string mes = "";
            //2020-01-06 待补充
            if (stateCodeStr == ErrorCode.NetworkError) {
                mes = ErrorCode.NetworkError;
            } else {
                mes = ErrorCode.OperationFailed + ErrorCode.Reason + stateCodeStr;
        ///// <summary>
        /////
        ///// </summary>
        ///// <param name="stateCodeStr"></param>
        //void ShowGetAllBindGatewarysPaggerErrorInfo (string stateCodeStr)
        //{
        //    string mes = "";
        //    //2020-01-06 待补充
        //    if (stateCodeStr == ErrorCode.NetworkError) {
        //        mes = ErrorCode.NetworkError;
        //    } else {
        //        mes = ErrorCode.OperationFailed + ErrorCode.Reason + stateCodeStr;
            }
            if (!string.IsNullOrEmpty (mes)) {
                Application.RunOnMainThread (() => {
                    new Alert ("", mes, Language.StringByID (R.MyInternationalizationString.Close)).Show ();
                });
            }
        //    }
        //    if (!string.IsNullOrEmpty (mes)) {
        //        Application.RunOnMainThread (() => {
        //            new Alert ("", mes, Language.StringByID (R.MyInternationalizationString.Close)).Show ();
        //        });
        //    }
        }
        //}
        /// <summary>
        /// 登录
        /// 登录 2020-01-11
        /// </summary>
        /// <param name="account">Account.</param>
        /// <param name="password">Password.</param>
@@ -455,10 +455,10 @@
                    //    //当住宅为空时先提示用户新建住宅
                    //} else {
                    var revertRoomData = mResidenceRes.PageData;
                    if (revertRoomData.Find ((obj) => obj.Id == UserConfig.Instance.CurrentRegion.Id) == null) {
                    if (UserConfig.Instance.CurrentRegion == null) {
                        if (revertRoomData != null && revertRoomData.Count > 0) {
                            var bFind = false;
                            foreach(var mHome in revertRoomData) {
                            foreach (var mHome in revertRoomData) {
                                if (UserConfig.Instance.CheckThisHomeGatewaysNotEmpty (mHome)) {
                                    bFind = true;
                                    UserConfig.Instance.CurrentRegion = mHome;
@@ -468,16 +468,41 @@
                            if (!bFind) {
                                UserConfig.Instance.CurrentRegion = revertRoomData [0];
                            }
                            //if (UserConfig.Instance.CheckHomeGateways ()) {
                            //    UserConfig.Instance.GatewayMAC = revertRoomData [0].HomeGateways [0].GatewayUniqueId;
                            //}
                            //CheckIfNeedGetMasterAccountToken ();
                            IO.FileUtils.DeleteAllFile ();
                        }
                    } else {
                        Room.InitAllRoom ();
                        //2020-01-11
                        var findRoom = revertRoomData.Find ((obj) => obj.Id == UserConfig.Instance.CurrentRegion.Id);
                        if (findRoom == null) {
                            if (revertRoomData != null && revertRoomData.Count > 0) {
                                var bFind = false;
                                foreach (var mHome in revertRoomData) {
                                    if (UserConfig.Instance.CheckThisHomeGatewaysNotEmpty (mHome)) {
                                        bFind = true;
                                        UserConfig.Instance.CurrentRegion = mHome;
                                        break;
                                    }
                                }
                                if (!bFind) {
                                    UserConfig.Instance.CurrentRegion = revertRoomData [0];
                                }
                                IO.FileUtils.DeleteAllFile ();
                            }
                        } else {
                            //刷新住宅 解决子账号问题
                            UserConfig.Instance.CurrentRegion = findRoom;
                            Room.InitAllRoom ();
                        }
                    }
                    ////原方案
                    //GetAllBindGatewarysPagger (revertRoomData);
@@ -564,13 +589,13 @@
                A31MusicModel.Refresh ();
                Application.RunOnMainThread (() => {
                    Close ();
                    UserMiddle.Init ();
                    UserMiddle.Init (false,true);
                    EquipmentPublicClass.CheckLinkRemote (2);
                });
            } else {
                Application.RunOnMainThread (() => {
                    UserMiddle.Init ();
                    UserMiddle.Init (false, true);
                    Close ();
                });
            }