From 0bf9e65bc3ba98391e7835c922b15baab3c77876 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 01 六月 2020 14:59:39 +0800
Subject: [PATCH] 上传一个合并的版本

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs |   47 ++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs
index 672bc3f..c10dfa4 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs
@@ -2216,7 +2216,7 @@
             {
                 int waitCount = 0;
                 //濡傛灉浣忓畢ID鍙樻洿浜�,鍒欎笉鍐嶅鐞�
-                while (frameLayout.Parent != null)
+                while (frameLayout.Parent != null && Config.Instance.HomeId != string.Empty)
                 {
                     System.Threading.Thread.Sleep(1000);
                     if (this.hadGatewayUpdate == true)
@@ -2276,18 +2276,34 @@
             //绛変釜2绉�
             System.Threading.Thread.Sleep(2000);
 
+            //2020.05.25杩藉姞:姝や綇瀹呮槸鍚︽嫢鏈夌綉鍏冲湪绾�
+            var hadGwOnline = false;
+            foreach (var way in list)
+            {
+                string gwId = this.GetGatewayId(way);
+                if (dicOldOnline.ContainsKey(gwId) == true)
+                {
+                    if (way.GatewayOnlineFlage == true)
+                    {
+                        //鏈変竴涓綉鍏冲湪绾�,鍗冲湪绾�
+                        hadGwOnline = true;
+                        break;
+                    }
+                }
+            }
+
             foreach (var way in list)
             {
                 string gwId = this.GetGatewayId(way);
                 if (dicOldOnline.ContainsKey(gwId) == true)
                 {
                     //缃戝叧涔熶笉澶�,鐩存帴鎺ㄩ�佸惂
-                    this.PushGatewayOnlineStatuToForm(gwId, way.GatewayOnlineFlage);
+                    this.PushGatewayOnlineStatuToForm(gwId, way.GatewayOnlineFlage, hadGwOnline);
                 }
                 else
                 {
                     //娌℃湁鍖呭惈,榛樿涓篺alse
-                    this.PushGatewayOnlineStatuToForm(gwId, false);
+                    this.PushGatewayOnlineStatuToForm(gwId, false, hadGwOnline);
                 }
             }
         }
@@ -2305,22 +2321,34 @@
                 dicDbGateway = new Dictionary<string, GatewayResult>();
             }
 
+            //2020.05.25杩藉姞:姝や綇瀹呮槸鍚︽嫢鏈夌綉鍏冲湪绾�
+            var hadGwOnline = false;
+            foreach (var gwId in dicOldOnline.Keys)
+            {
+                //濡傛灉浜戠涓婇潰鏈夎繖涓綉鍏�
+                if (dicDbGateway.ContainsKey(gwId) == true
+                    && dicDbGateway[gwId].MqttOnlineStatus == true)
+                {
+                    //鏈変竴涓綉鍏冲湪绾�,鍗冲湪绾�
+                    hadGwOnline = true;
+                    break;
+                }
+            }
+
             foreach (var gwId in dicOldOnline.Keys)
             {
                 //濡傛灉浜戠涓婇潰鏈夎繖涓綉鍏�
                 if (dicDbGateway.ContainsKey(gwId) == true)
                 {
                     //缃戝叧涔熶笉澶�,鐩存帴鎺ㄩ��
-                    this.PushGatewayOnlineStatuToForm(gwId, dicDbGateway[gwId].MqttOnlineStatus);
+                    this.PushGatewayOnlineStatuToForm(gwId, dicDbGateway[gwId].MqttOnlineStatus, hadGwOnline);
                 }
                 else
                 {
                     //浜戠涓嶅寘鍚殑,褰撲笉鍦ㄧ嚎澶勭悊
-                    this.PushGatewayOnlineStatuToForm(gwId, false);
+                    this.PushGatewayOnlineStatuToForm(gwId, false, hadGwOnline);
                 }
             }
-
-           
         }
 
         /// <summary>
@@ -2355,7 +2383,8 @@
         /// </summary>
         /// <param name="gwId"></param>
         /// <param name="online"></param>
-        private void PushGatewayOnlineStatuToForm(string gwId, bool online)
+        /// <param name="hadGwOnline">2020.05.25杩藉姞:姝や綇瀹呮槸鍚︽嫢鏈夌綉鍏冲湪绾�</param>
+        private void PushGatewayOnlineStatuToForm(string gwId, bool online, bool hadGwOnline)
         {
             try
             {
@@ -2370,7 +2399,7 @@
                     var zbway = this.GetLocalGateway(gwId);
                     zbway.GatewayOnlineFlage = online;
 
-                    UserCenterResourse.DicActionForm[formId]?.GatewayOnlinePush(zbway, online);
+                    UserCenterResourse.DicActionForm[formId]?.GatewayOnlinePush(zbway, online, hadGwOnline);
                 }
             }
             catch { }

--
Gitblit v1.8.0