From 5428935270159bfc42c2934ed7fb1091554fc9a4 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 09 七月 2020 17:12:42 +0800
Subject: [PATCH] 修改了 sokect

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs |   40 ++++++++++++++++++++++++++++++----------
 1 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs
index 7bf85cc..ce24a39 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs
@@ -151,8 +151,8 @@
             }
             get
             {
-                //10绉掑悗鍏佽鍐嶆璁块棶
-                if (m_CanAccessHttp == true || (DateTime.Now - oldAccessHttpTime).TotalMilliseconds > 10 * 1000)
+                //8绉掑悗鍏佽鍐嶆璁块棶
+                if (m_CanAccessHttp == true || (DateTime.Now - oldAccessHttpTime).TotalMilliseconds > 8 * 1000)
                 {
                     oldAccessHttpTime = DateTime.Now;
                     return true;
@@ -368,23 +368,43 @@
         /// <summary>
         /// 鐩戝惉瀹夊崜缃戠粶鍙樺寲
         /// </summary>
-        /// <param name="value"></param>
+        /// <param name="value">0:娌℃湁缃戠粶 1:4G  2:wifi</param>
         private void NetworkStateChanged(int value)
         {
             //娌℃湁缃戠粶
             if (value == 0)
             {
                 this.CanAccessHttp = false;
+                //鍏抽棴Socket
+                ZigBee.Common.Application.FindGateWaySocket.Stop();
             }
-            //鍙互鍙�4G
-            else if (value == 1)
+            //WIFI鎴栬��4G鏃�
+            if (value == 1 || value == 2)
             {
+                //鍏佽鑱旂綉
                 this.CanAccessHttp = true;
-            }
-            //WIFI
-            else if (value == 2)
-            {
-                this.CanAccessHttp = true;
+
+                //妫�娴嬫槸鍚﹀凡缁忓畬鎴愯处鍙蜂俊鎭垵濮嬪寲
+                if (UserCenterResourse.UserInfo.InitUserInfoSuccess == false
+                   && Common.Config.Instance.HomeId != string.Empty)
+                {
+                    HdlThreadLogic.Current.RunThread(() =>
+                    {
+                        ProgressBar.Show();
+                        //閲嶆柊鍒濆鍖栬处鍙蜂俊鎭�
+                        UserCenterLogic.ReInitUserAccoutInfo();
+                        ProgressBar.Close();
+
+                    }, ShowErrorMode.NO);
+                }
+                //閲嶆柊鍒濆鍖朣ocket
+                ZigBee.Common.Application.FindGateWaySocket.Stop();
+                if (value == 2)
+                {
+                    ZigBee.Common.Application.FindGateWaySocket.Start();
+                }
+                //鏂帀鏈湴杩炴帴
+                HdlGatewayLogic.Current.ClearAllRealGateway();
             }
         }
 

--
Gitblit v1.8.0