Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs
@@ -31,10 +31,11 @@
#if wallon
                return;
#endif
            if (MainPage.LoginUser == null || !MainPage.LoginUser.IsLogin) {
            if (MainPage.LoginUser == null || !MainPage.LoginUser.IsLogin || isConnectiong) {
                return;
            }
            isConnectiong = true;
            new System.Threading.Thread (async () => {
                try {
                    if (status == 0) {
@@ -44,9 +45,7 @@
                            UserMiddle.btnLinkStatus.UnSelectedImagePath = MainPage.WiFiStatus;
                        });
                    } else {
                        if (MainPage.LoginUser == null || !MainPage.LoginUser.IsLogin) {
                            return;
                        }
                        //Application.RunOnMainThread (() => {
                        //    if (UserMiddle.LinkStatusTip.BackgroundColor == SkinStyle.Current.DelColor) {
                        //        UserMiddle.LinkStatusTip.BackgroundColor = SkinStyle.Current.MainColor;
@@ -63,9 +62,7 @@
                        });
                        bool canRemote = false;
                        if (CommonPage.IsRemote) {
                            //await SmartHome.MqttCommon.DisConnectRemoteMqttClient ();
                            //await SmartHome.MqttCommon.StartCloudMqtt ();
                            await SmartHome.MqttCommon.StartCloudMqtt ();
                            SmartHome.MqttCommon.MqttRemoteSend (new byte [] { }, 3);
                        }
                        foreach (var gatewayFileName in gateWayList) {
@@ -93,26 +90,27 @@
                                            canRemote = false;
                                            var mac0 = CommonPage.byteToHex16 (result [5]) + "." + CommonPage.byteToHex16 (result [6]) + "." + CommonPage.byteToHex16 (result [7]) + "." + CommonPage.byteToHex16 (result [8]) + "." + CommonPage.byteToHex16 (result [9]) + "." + CommonPage.byteToHex16 (result [10]) + "." + CommonPage.byteToHex16 (result [11]) + "." + CommonPage.byteToHex16 (result [12]);
                                            if (common.MAC == mac0) {
                                                CommonPage.IsRemote = false;
                                                //var gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, common.SubnetID, common.DeviceID, new byte [] { });
                                                #region
                                                control.Send (new Target () {
                                                    IPEndPoint = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (new Net.NetWiFi ().BroadcastIpAddress.ToString ()), 6000),
                                                    Command = Command.ReadGateWayModelInfo,
                                                    SubnetID = common.SubnetID,
                                                    DeviceID = common.DeviceID,
                                                    AddData = new byte [] { },
                                                }, SendCount.Three, true,true);
                                                var gatewayBytes = control.UsefulBytes;
                                                #endregion
                                                if (gatewayBytes != null) {
                                                    //common.Remote_GroupName = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 1, 20).Trim ('\0');
                                                    //common.Remote_ProjectName = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 21, 20).Trim ('\0');
                                                    //common.Remote_UserName = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 41, 8).Trim ('\0');
                                                    //common.Remote_Password = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 49, 8).Trim ('\0');
                                                    //var requestJson2 = @"{'Token':'" + MainPage.LoginUser.LoginTokenString + "','MAC':'" + common.MAC + "','Password':'" + common.Remote_Password + "'}";
                                                    //var revertObj2 = MainPage.RequestHttps ("UpdateRemoteSwitchPassword", requestJson2, true, false);
                                                    return;
                                                }
                                                //#region
                                                //control.Send (new Target () {
                                                //    IPEndPoint = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (new Net.NetWiFi ().BroadcastIpAddress.ToString ()), 6000),
                                                //    Command = Command.ReadGateWayModelInfo,
                                                //    SubnetID = common.SubnetID,
                                                //    DeviceID = common.DeviceID,
                                                //    AddData = new byte [] { },
                                                //}, SendCount.Three, true,true);
                                                //var gatewayBytes = control.UsefulBytes;
                                                //#endregion
                                                //if (gatewayBytes != null) {
                                                //common.Remote_GroupName = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 1, 20).Trim ('\0');
                                                //common.Remote_ProjectName = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 21, 20).Trim ('\0');
                                                //common.Remote_UserName = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 41, 8).Trim ('\0');
                                                //common.Remote_Password = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 49, 8).Trim ('\0');
                                                //var requestJson2 = @"{'Token':'" + MainPage.LoginUser.LoginTokenString + "','MAC':'" + common.MAC + "','Password':'" + common.Remote_Password + "'}";
                                                //var revertObj2 = MainPage.RequestHttps ("UpdateRemoteSwitchPassword", requestJson2, true, false);
                                                //return;
                                                //}
                                                Application.RunOnMainThread (() => {
                                                    MainPage.WiFiStatus = "CrabtreeAdd/WiFi.png";
                                                    UserMiddle.btnLinkStatus.UnSelectedImagePath = MainPage.WiFiStatus;