From 59d9f0ad6dc40b079fa1f8f514698429ead04a75 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 17 七月 2023 13:28:22 +0800
Subject: [PATCH] Merge branch 'Dev-Branch' into Dev-Wxr-1.8.1

---
 HDL_ON/DAL/DriverLayer/Control.cs |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index c89474a..0df687c 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -1,6 +1,7 @@
 锘縰sing System;
 using System.Collections.Generic;
 using System.Text;
+using HDL_ON.DAL.Mqtt;
 using HDL_ON.DAL.Server;
 using HDL_ON.Entity;
 using HDL_ON.UI;
@@ -124,6 +125,10 @@
                         HomePage.LoadEvent_CheckLinkStatus();
                     }
                 }
+                else
+                {
+                    MainPage.Log($"鐘舵�佷竴鑷达紝涓嶆洿鏂版暟鎹�(鏈湴)");
+                }
             }
         }
         bool _GatewayOnline_Cloud = false;
@@ -169,7 +174,16 @@
                             MainPage.Log($"缃戝叧浜戠鍦ㄧ嚎锛屽埛鏂拌澶囩姸鎬�");
                             new System.Threading.Thread(() =>
                             {
-                                System.Threading.Thread.Sleep(1000);
+                                int count = 20;
+                                while (true)
+                                {
+                                    System.Threading.Thread.Sleep(500);
+                                    if (MqttClient.isSubscribeSuccess || count<1)
+                                    {
+                                        break;
+                                    }
+                                    count--;
+                                }
                                 FunctionList.List.ReadAllFunctionStatus();
                             })
                             { IsBackground = true, Priority = System.Threading.ThreadPriority.AboveNormal }.Start();
@@ -179,6 +193,10 @@
                             //淇敼涓婚〉杩炴帴鐘舵��
                             HomePage.LoadEvent_CheckLinkStatus();
                         }
+                    }
+                    else
+                    {
+                        MainPage.Log($"鐘舵�佷竴鑷达紝涓嶆洿鏂版暟鎹�(浜戠)");
                     }
                 }catch(Exception ex)
                 {
@@ -277,6 +295,7 @@
             }
             else if (MainPage.InternetStatus == 2)
             {
+                DAL.Mqtt.MqttClient.InitState();
                 OpenUdp(DB_ResidenceData.Instance.GatewayType == 0 ? 6000 : 8585);
                 //閲嶇疆鎼滅储缃戝叧鏍囧織
                 IsSearchLocalGatewaySuccessful = false;
@@ -303,7 +322,6 @@
                         System.Threading.Thread.Sleep(500);
                     }
 
-                    DAL.Mqtt.MqttClient.InitState();
                 })
                 { IsBackground = true }.Start();
             }

--
Gitblit v1.8.0