From 5eeafe3af80bfd88306bd8ad9e76c8f4b51ca35f Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期四, 17 十二月 2020 14:16:20 +0800
Subject: [PATCH] 增加本地发送的重发机制

---
 HDL_ON/DAL/Mqtt/MqttClient.cs |   40 ++++++++++++++++++++++++++++++----------
 1 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs
index bbd535a..4ddfc8e 100644
--- a/HDL_ON/DAL/Mqtt/MqttClient.cs
+++ b/HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -289,7 +289,7 @@
                                     {
                                         //A鍗忚鏁版嵁澶勭悊
                                         var revString = Encoding.UTF8.GetString(bytes);
-                                        Control.Ins.UpdataFunctionStatus(revString);
+                                        Control.Ins.UpdataFunctionStatus(revString,null);
                                     }
                                 }
                             }
@@ -310,11 +310,27 @@
                     if (RemoteMqttClient.ConnectedHandler == null)
                     {
                         RemoteMqttClient.UseConnectedHandler(async (e) => {
-                            Control.Ins.GatewayOnline = true;
+                            if (DB_ResidenceData.Instance.HomeGateway.gatewayStatus)
+                            {
+                                Control.Ins.GatewayOnline = true;
+                            }
+                            else
+                            {
+                                //new System.Threading.Thread(() => {
+                                //    while(true)
+                                //    {
+                                //        System.Threading.Thread.Sleep(1000);
+                                //        if (DB_ResidenceData.Instance.HomeGateway.GatewayOnline)
+                                //        {
+                                //            Control.Ins.GatewayOnline = true;
+                                //            break;
+                                //        }
+                                //    }
+                                //}) { IsBackground = true }.Start();
+                            }
                             IfNeedReadAllDeviceStatus = true;
                             Utlis.WriteLine($"============>Mqtt杩滅▼杩炴帴鎴愬姛");
                             SendPushSignOut();
-                            //FunctionList.List.ReadAllFunctionStatus();
                         });
                     }
                     #endregion
@@ -524,7 +540,9 @@
         /// </summary>
         static void ReceiveNotifySqueezeAsync(string mMes)
         {
-
+#if DEBUG
+            return;
+#endif
             if (mMes == PushSignStr) return;//鏄嚜宸辩殑鐧诲綍鎺ㄩ�佷笉澶勭悊
 
             //鏂紑杩滅▼杩炴帴
@@ -536,13 +554,15 @@
 
             DisConnectRemoteMqttClient("鎸や笅绾�");
 
-            UserInfo.Current.LastTime = DateTime.MinValue;
-            UserInfo.Current.SaveUserInfo();
+            HDLCommon.Current.CheckLogout();
 
-            Application.RunOnMainThread(() => {
-                MainPage.GoLoginPage(UserInfo.Current);
-                //寮圭獥鎻愮ず琚尋涓嬬嚎
-            });
+            //UserInfo.Current.LastTime = DateTime.MinValue;
+            //UserInfo.Current.SaveUserInfo();
+
+            //Application.RunOnMainThread(() => {
+            //    MainPage.GoLoginPage(UserInfo.Current);
+            //    //寮圭獥鎻愮ず琚尋涓嬬嚎
+            //});
 
             //2020-08-11 鍒犻櫎鎺ㄩ�佹暟鎹�
             //HDLRequest.Current.PushserivceSignOut ();

--
Gitblit v1.8.0