From da3634e011bbda29cf4e1c168997b780fe795b20 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期三, 13 五月 2020 09:05:23 +0800
Subject: [PATCH] 优化新风模块和新风面板的测试功能,请合并代码

---
 ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs |   50 ++++++++------------------------------------------
 1 files changed, 8 insertions(+), 42 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs b/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs
index 89ec837..5fb22cb 100755
--- a/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs
@@ -104,18 +104,25 @@
                             {
                                 searchCount = 6;
                                 ZbGateway.IsRemote = false;
+                                //褰撶綉鍏崇殑杩炴帴鏂瑰紡鏀瑰彉鏃�,璁板綍褰撳墠鐨勮繛鎺ユ柟寮�
+                                Shared.Phone.UserCenter.HdlGatewayLogic.Current.CheckGatewayByConnectChanged(Shared.Phone.UserCenter.GatewayConnectMode.WIFI);
                             }
                             else
                             {
                                 if (searchCount < 0)
                                 {
                                     ZbGateway.IsRemote = true;
+                                    //褰撶綉鍏崇殑杩炴帴鏂瑰紡鏀瑰彉鏃�,璁板綍褰撳墠鐨勮繛鎺ユ柟寮�
+                                    Shared.Phone.UserCenter.HdlGatewayLogic.Current.CheckGatewayByConnectChanged(Shared.Phone.UserCenter.GatewayConnectMode.Remote);
                                 }
                             }
                         }
                         else
                         {
                             ZbGateway.IsRemote = true;
+                            //褰撶綉鍏崇殑杩炴帴鏂瑰紡鏀瑰彉鏃�,璁板綍褰撳墠鐨勮繛鎺ユ柟寮�
+                            Shared.Phone.UserCenter.HdlGatewayLogic.Current.CheckGatewayByConnectChanged(Shared.Phone.UserCenter.GatewayConnectMode.Remote);
+
                             for (int i = 0; i < ZbGateway.GateWayList.Count; i++)
                             {
                                 ZbGateway.GateWayList[i].DisConnectLocalMqttClient("1");
@@ -303,48 +310,7 @@
                     try
                     {
                         //瀹氭椂妫�娴嬭繙绋嬭繛鎺ユ儏鍐�
-                        await ZbGateway.StartRemoteMqtt();
-                        if (!ZbGateway.IsRemote)
-                        {
-                            System.Threading.Thread.Sleep(500);
-                            continue;
-                        }
-                        var gateWayList = ZbGateway.GateWayList.FindAll(obj => obj.getGatewayBaseInfo.HomeId == Shared.Common.Config.Instance.HomeId);
-
-                        if (gateWayList.Count == 1)
-                        {
-                            gateWayList[0].getGatewayBaseInfo.IsMainGateWay = true;
-                        }
-                        else
-                        {
-                            if (gateWayList.Find((obj) => obj.getGatewayBaseInfo.IsMainGateWay) == null)
-                            {
-                                for (int i = 0; i < gateWayList.Count; i++)
-                                {
-                                    var gateWay = gateWayList[i];
-                                    var info = await gateWay.GetZbGwInfoAsync();
-                                    if (info == null || info.getGwData == null)
-                                    {
-                                        continue;
-                                    }
-                                    if (info.getGwData.IsDominant == 1)
-                                    {
-                                        for (int j = 0; j < gateWayList.Count; j++)
-                                        {
-                                            if (gateWayList[i].getGatewayBaseInfo.gwID == info.getGwData.GwId)
-                                            {
-                                                gateWayList[i].getGatewayBaseInfo.IsMainGateWay = true;
-                                            }
-                                            else
-                                            {
-                                                gateWayList[i].getGatewayBaseInfo.IsMainGateWay = false;
-                                            }
-                                        }
-                                        break;
-                                    }
-                                }
-                            }
-                        }
+                        await ZbGateway.StartRemoteMqtt();
                     }
                     catch { }
                     System.Threading.Thread.Sleep(2000);

--
Gitblit v1.8.0