| | |
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | HdlGatewayLogic.Current.ClearAllRealGatewayConection(true);
|
| | | await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient();
|
| | | await ZigBee.Device.ZbGateway.CloseRemoteConnectionOnForce();
|
| | | }, ShowErrorMode.NO);
|
| | | }
|
| | |
|
| | |
| | | /// </summary>
|
| | | public static void RefreshHomeObject()
|
| | | {
|
| | | //还原住宅对象
|
| | | 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);
|
| | |
|
| | | //主页需要重新刷新
|
| | |
| | | //断开远程Mqtt连接
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient();
|
| | | await ZigBee.Device.ZbGateway.CloseRemoteConnectionOnForce();
|
| | | }, ShowErrorMode.NO);
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | |
| | | var form = new HideOption.HideOptionMainForm();
|
| | | form.AddForm();
|
| | | });
|
| | | ProgressBar.Close(true);
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | HdlGatewayLogic.Current.ClearAllRealGatewayConection(true);
|
| | | await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient();
|
| | | await ZigBee.Device.ZbGateway.CloseRemoteConnectionOnForce();
|
| | | }, ShowErrorMode.NO);
|
| | |
|
| | | //刷新APP前一次选择的网关ID(可以反复调用,需要在网关初始化完了之后才能调用)
|
| | |
| | | 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;
|
| | | }
|
| | |
| | | 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 ■ 初始化登陆账号的信息_______________
|