Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs
@@ -46,6 +46,9 @@
            }
            new System.Threading.Thread (async () => {
                bool IsRemoteLoadingShow = false;
                try {
                    if (status == 0) {
                        Application.RunOnMainThread (() => {
@@ -75,6 +78,7 @@
                        });
                        bool canRemote = false;
                      
                        //1.如果本地没网关数据,提示WiFiOffline,并且判断是否需要断开远程
                        if (gateWayList == null || gateWayList.Count == 0) {
@@ -112,7 +116,7 @@
                                        //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 () {
@@ -165,12 +169,13 @@
                                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);
                                    }
                                }
@@ -196,14 +201,16 @@
                    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