| | |
| | | } |
| | | |
| | | new System.Threading.Thread (async () => { |
| | | |
| | | bool IsRemoteLoadingShow = false; |
| | | |
| | | try { |
| | | if (status == 0) { |
| | | Application.RunOnMainThread (() => { |
| | |
| | | }); |
| | | bool canRemote = false; |
| | | |
| | | |
| | | |
| | | //1.如果本地没网关数据,提示WiFiOffline,并且判断是否需要断开远程 |
| | | if (gateWayList == null || gateWayList.Count == 0) { |
| | |
| | | //var result = Control.ControlBytesSendHasReturn (Command.ReadGateway, common.SubnetID, common.DeviceID, new byte [] { (byte)new Random ().Next (255), (byte)new Random ().Next (255) }); |
| | | #region |
| | | //开始本地搜索网关... |
| | | MainPage.AddTip ("Searching local gateway..."); |
| | | MainPage.LoadingStart ("Searching local gateway..."); |
| | | |
| | | var control = new Control (); |
| | | control.Send (new Target () { |
| | |
| | | if (UserConfig.Instance.CheckHomeGateways ()) { |
| | | if (!string.IsNullOrEmpty (UserConfig.Instance.CurrentRegion.HomeGateways [0].GatewayUniqueId)) { |
| | | // 5.1能远程,显示CloudUnlink状态,IsRemote设为true开始远程 |
| | | MainPage.AddTip ("Please wait, starting remote connection..."); |
| | | |
| | | Utlis.ShowAppLinkStatus (AppLinkStatus.CloudUnlink); |
| | | //MainPage.AddTip ("Please wait, starting remote connection..."); |
| | | MainPage.LoadingStart ("Please wait, starting remote connection..."); |
| | | CommonPage.IsRemote = true; |
| | | IsRemoteLoadingShow = true; |
| | | //重置参数状态 |
| | | SmartHome.MqttCommon.InitState (); |
| | | Utlis.ShowAppLinkStatus (AppLinkStatus.CloudUnlink); |
| | | |
| | | } |
| | | } |
| | |
| | | Utlis.WriteLine ("CheckLinkRemote : " + ex.ToString ()); |
| | | } finally { |
| | | isConnectiong = false; |
| | | Application.RunOnMainThread (() => { |
| | | MainPage.Loading.Hide (); |
| | | }); |
| | | if (!IsRemoteLoadingShow) { |
| | | Application.RunOnMainThread (() => { |
| | | MainPage.Loading.Hide (); |
| | | }); |
| | | } |
| | | } |
| | | }) { IsBackground = true }.Start (); |
| | | } |
| | | |
| | | |
| | | //static bool IsRemoteLoadingShow = false; |
| | | |
| | | /// <summary> |
| | | /// 关闭远程连接模式,并断开MQTT |