| | |
| | | /// </summary>
|
| | | public static void RefreshHomeObject()
|
| | | {
|
| | | //备份的数据,有可能是主人自己上传的,如果管理员登陆时,他获取的备份数据有点特殊
|
| | | //比如下面这三个东西在主账号那里是不需要的
|
| | | bool isOthreShare = Config.Instance.Home.IsOthreShare;
|
| | | int accountType = Config.Instance.Home.AccountType;
|
| | | string mainMark = Config.Instance.Home.MainUserDistributedMark;
|
| | | double Longitude = Config.Instance.Home.Longitude;
|
| | | double Latitude = Config.Instance.Home.Latitude;
|
| | | //还原住宅对象
|
| | | Config.Instance.Home = HdlResidenceLogic.Current.GetHouseByHouseId(Config.Instance.Home.Id);
|
| | | Config.Instance.Home.IsOthreShare = isOthreShare;
|
| | | Config.Instance.Home.AccountType = accountType;
|
| | | Config.Instance.Home.MainUserDistributedMark = mainMark;
|
| | | Config.Instance.Home.Longitude = Longitude;
|
| | | Config.Instance.Home.Latitude = Latitude;
|
| | | var home = HdlResidenceLogic.Current.GetHouseByHouseId(Config.Instance.Home.Id);
|
| | |
|
| | | //刷新楼层
|
| | | Config.Instance.Home.FloorDics = home.FloorDics;
|
| | | Config.Instance.Home.CurrentFloorId = string.Empty;
|
| | | if (Config.Instance.Home.TemplateMode == -1)
|
| | | {
|
| | | Config.Instance.Home.TemplateMode = home.TemplateMode;
|
| | | if (Config.Instance.Home.TemplateMode == -1)
|
| | | {
|
| | | //默认初始值
|
| | | Config.Instance.Home.TemplateMode = 1;
|
| | | }
|
| | | }
|
| | |
|
| | | Config.Instance.Home.Save(false);
|
| | |
|
| | | //主页需要重新刷新
|
| | | UserView.UserPage.Instance.RefreshAllForm = true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | var form = new HideOption.HideOptionMainForm();
|
| | | form.AddForm();
|
| | | });
|
| | | ProgressBar.Close(true);
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
| | | System.Threading.Thread.Sleep(30);
|
| | | if (hadNet == 1)
|
| | | {
|
| | | try
|
| | | {
|
| | | bool canReceiveGw = false;
|
| | | foreach (var gateway in UserCenterResourse.DicReceiveGatewayTest.Values)
|
| | | {
|
| | | if (gateway.HomeId == Config.Instance.Home.Id)
|
| | | {
|
| | | //能够搜索得到网关
|
| | | canReceiveGw = true;
|
| | | break;
|
| | | }
|
| | | }
|
| | | UserCenterResourse.DicReceiveGatewayTest = null;
|
| | | //设置远程连接的初始值
|
| | | ZigBee.Device.ZbGateway.IsRemote = canReceiveGw == false;
|
| | | if (canReceiveGw == false)
|
| | | {
|
| | | //如果是远程的话,追加等待时间
|
| | | System.Threading.Thread.Sleep(1500);
|
| | | }
|
| | | }
|
| | | catch { }
|
| | | //住宅切换时,检测网关连接情况
|
| | | CheckGatewayConnection();
|
| | |
|
| | | }
|
| | | UserCenterResourse.DicReceiveGatewayTest = null;
|
| | | }
|
| | | //APP缓存加载完成
|
| | | UserCenterResourse.AccountOption.AppCanSignout = true;
|
| | | if (Shared.Phone.Device.Logic.Send.If_Exist == "1")
|
| | | {
|
| | | //以本地状态为主打开GPS服务
|
| | | Application.StartGPSLocationService();
|
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
| | | Common.Logic.SoneLogicList.Clear();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 住宅切换时,检测网关连接情况
|
| | | /// </summary>
|
| | | private static void CheckGatewayConnection()
|
| | | {
|
| | | try
|
| | | {
|
| | | bool canReceiveGw = false;
|
| | | foreach (var gateway in UserCenterResourse.DicReceiveGatewayTest.Values)
|
| | | {
|
| | | if (gateway.HomeId == Config.Instance.Home.Id)
|
| | | {
|
| | | //能够搜索得到网关
|
| | | canReceiveGw = true;
|
| | | break;
|
| | | }
|
| | | }
|
| | | UserCenterResourse.DicReceiveGatewayTest = null;
|
| | | //设置远程连接的初始值
|
| | | ZigBee.Device.ZbGateway.IsRemote = canReceiveGw == false;
|
| | | if (canReceiveGw == false)
|
| | | {
|
| | | //如果是远程的话,追加等待时间
|
| | | System.Threading.Thread.Sleep(1500);
|
| | | }
|
| | | }
|
| | | catch { }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化登陆账号的信息_______________
|