From e327510c7329aa9a95e62a460ec659ea0c9563ad Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期六, 19 十二月 2020 19:05:47 +0800
Subject: [PATCH] Merge branch 'CJL' into NewFilePath

---
 HDL-ON_Android/Application.cs |   39 +++++++++++++++++++++++++++++++--------
 1 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/HDL-ON_Android/Application.cs b/HDL-ON_Android/Application.cs
index 3d80e26..44e4c01 100644
--- a/HDL-ON_Android/Application.cs
+++ b/HDL-ON_Android/Application.cs
@@ -86,7 +86,7 @@
                     //}
 
                     //缃戠粶鍙樺寲澶勭悊
-                    HDLCommon.Current.UpdateInternetStatus((int)internetStatus, IsEnterBackground);
+                    HDLCommon.Current.UpdateInternetStatus((int)internetStatus, MainPage.IsEnterBackground);
                 };
                 //寮�鍚畾浣嶆湇鍔�
                 Shared.Application.StartGPSLocationService();
@@ -309,30 +309,53 @@
 
         int mCount;
 
+        ///// <summary>
+        ///// 鏄惁杩涘叆鍚庡彴
+        ///// </summary>
+        //public bool IsEnterBackground = false;
+
         /// <summary>
-        /// 鏄惁杩涘叆鍚庡彴
+        /// 杩涘叆鍚庡彴鐨勬椂闂�
         /// </summary>
-        public bool IsEnterBackground = false;
+        DateTime CloseTime = DateTime.Now;
 
         /// <summary>
         /// BusSocketStop
         /// </summary>
         void BusSocketStop()
         {
-            IsEnterBackground = true;
-            //BusSocket.Stop();
+            //IsEnterBackground = true;
+            CloseTime = DateTime.Now;
+            MainPage.IsEnterBackground = true;
+            //杩涘叆鍚庡彴mqtt姝e湪杩炴帴閲嶇疆鐘舵��
+            HDL_ON.DAL.Mqtt.MqttClient.RemoteMqttIsConnecting = false;
+            HDL_ON.DriverLayer.UdpSocket._BusSocket.Stop();
+           
         }
-
 
         /// <summary>
         /// BusSocketStart
         /// </summary>
         void BusSocketStart()
         {
-            IsEnterBackground = false;
+            //IsEnterBackground = false;
 
-            //BusSocket.Start();
+            if (CloseTime.AddSeconds(10) < DateTime.Now)
+            {
+                //鍚庡彴瓒呰繃10s灏辨柇寮�MQTT閲嶈繛
+                if (HDL_ON.DriverLayer.Control.Ins.IsRemote)
+                {
+                    HDL_ON.DAL.Mqtt.MqttClient.DisConnectRemote("closeTime", false);
+                }
+            }
+
+            MainPage.IsEnterBackground = false;
+            HDL_ON.DriverLayer.UdpSocket._BusSocket.Start();
+            HDL_ON.DriverLayer.Control.Ins.SearchLoaclGateway();
         }
+
+      
+
     }
 
 }
\ No newline at end of file

--
Gitblit v1.8.0