From b3e96fce4cc01113128ddf8e0a18fc19594a9e56 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 05 十二月 2019 18:38:30 +0800
Subject: [PATCH] 一个新的版本

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs
index 660ebbc..5a8c34a 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs
@@ -117,10 +117,20 @@
             {
                 return;
             }
+
+            List<string> listBackupGwId = new List<string>();
+            var fileData = Global.ReadFileByDirectory(DirNameResourse.LocalMemoryDirectory, DirNameResourse.BackupGatewayIdFile);
+            if (fileData != null)
+            {
+                //鏂板锛氳櫧鐒舵鐜囦綆锛屼絾鏄‘瀹炲彂鐢熶簡銆傚鏋滄湁缃戠粶鏃讹紝App閲嶆柊缁戝畾璁板綍鐨勭綉鍏冲け璐ョ殑璇�
+                //涓嶅簲璇ュ垹闄ゅ畠
+                listBackupGwId = JsonConvert.DeserializeObject<List<string>>(System.Text.Encoding.UTF8.GetString(fileData));
+            }
+
             List<string> listDelete = new List<string>();
             foreach (var gatewayId in this.dicGateway.Keys)
             {
-                if (result.ContainsKey(gatewayId) == false)
+                if (result.ContainsKey(gatewayId) == false && listBackupGwId.Contains(gatewayId) == false)
                 {
                     //鏈湴瀛樺湪浜戠涓嶅瓨鍦ㄧ殑缃戝叧锛屽垯鍒犻櫎
                     listDelete.Add(gatewayId);
@@ -451,7 +461,7 @@
                     btnMsg.TextID = R.MyInternationalizationString.uGatewayDataIsChangingPleaseWhait;
                 });
             }
-            await System.Threading.Tasks.Task.Delay(8000);
+            await Task.Delay(8000);
 
             //鑾峰彇缃戝叧鐨勪俊鎭�
             var result = await zbGateway.GetZbGwInfoAsync();
@@ -463,15 +473,7 @@
                 return -1;
             }
 
-            if (result == null)
-            {
-                //鑾峰彇缃戝叧淇℃伅澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uGetGatewayInfoFail);
-                this.ShowTipMsg(msg);
-                return -1;
-            }
-
-            if (result.getGwData == null)
+            if (result == null || result.getGwData == null)
             {
                 //鑾峰彇缃戝叧淇℃伅澶辫触
                 string msg = Language.StringByID(R.MyInternationalizationString.uGetGatewayInfoFail);

--
Gitblit v1.8.0