From bbe6bd34ded053c0ae33c018f3af53daac43629f Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 12 一月 2023 16:44:15 +0800
Subject: [PATCH] 数据下载优化

---
 HDL-ON_Android/Properties/AndroidManifest.xml    |    2 +-
 HDL-ON_iOS/Info.plist                            |    4 ++--
 HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs |    4 ++++
 HDL_ON/Common/ApiUtlis.cs                        |    3 ++-
 HDL_ON/Entity/DB_ResidenceData.cs                |    2 +-
 HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs      |    2 +-
 HDL_ON/UI/MainPage.cs                            |    2 +-
 HDL_ON/Entity/FunctionList.cs                    |   14 ++++++++------
 8 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml
index 0fafe5b..783d679 100644
--- a/HDL-ON_Android/Properties/AndroidManifest.xml
+++ b/HDL-ON_Android/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
 锘�<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.6.3" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202301102">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.6.3" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202301121">
 	<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" />
 	<!--鍙嬬洘-->
 	<!--<uses-sdk android:minSdkVersion="8"></uses-sdk>-->
diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist
index 5abd8ca..65fd544 100644
--- a/HDL-ON_iOS/Info.plist
+++ b/HDL-ON_iOS/Info.plist
@@ -98,9 +98,9 @@
 	<key>UIStatusBarStyle</key>
 	<string>UIStatusBarStyleLightContent</string>
 	<key>CFBundleShortVersionString</key>
-	<string>1.6.302301121</string>
+	<string>1.6.302301122</string>
 	<key>CFBundleVersion</key>
-	<string>1.6.301121</string>
+	<string>1.6.301122</string>
 	<key>NSLocationWhenInUseUsageDescription</key>
 	<string>Use geographic location to provide services such as weather</string>
 	<key>NSAppleMusicUsageDescription</key>
diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs
index 5ef13fc..333788e 100644
--- a/HDL_ON/Common/ApiUtlis.cs
+++ b/HDL_ON/Common/ApiUtlis.cs
@@ -171,7 +171,8 @@
                             var deviceResult = Ins.HttpRequest.GetDeviceList("30", "1");
                             if (deviceResult.Code == StateCode.SUCCESS)
                             {
-                                FunctionList.List.Clear();
+                                FunctionList.List.ClearDatas();
+                                MainPage.Log($"============璁惧============寮�濮�" + FunctionList.List.Functions.Count);
                                 //MainPage.Log($"璇诲彇璁惧淇℃伅鎴愬姛");
                                 //MainPage.Log($"sid鍒楄〃鑾峰彇====" + deviceResult.Data.ToString());
                                 var deviceList = JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString());
diff --git a/HDL_ON/Entity/DB_ResidenceData.cs b/HDL_ON/Entity/DB_ResidenceData.cs
index b41e1dc..3a0e4ee 100644
--- a/HDL_ON/Entity/DB_ResidenceData.cs
+++ b/HDL_ON/Entity/DB_ResidenceData.cs
@@ -152,7 +152,7 @@
             DriverLayer.Control.Ins.GatewayOnline_Cloud = false;
             DriverLayer.Control.Ins.GatewayOnline_Local = false;
             SpatialInfo.CurrentSpatial.Clear();
-            FunctionList.List.Clear();
+            FunctionList.List.ClearDatas();
 
             ///鍒囨崲浣忓畢娓呯┖鍓嶄綇瀹呯紦瀛樿嚜鍔ㄥ寲鍒楄〃锛�
             HDL_ON.UI.UI2.Intelligence.Automation.Logic.LogicList.Clear();
diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index 2999288..6060289 100644
--- a/HDL_ON/Entity/FunctionList.cs
+++ b/HDL_ON/Entity/FunctionList.cs
@@ -19,7 +19,7 @@
             try
             {
                 _FunctionList._IpCamImou = null;
-                _FunctionList.Clear();
+                _FunctionList.ClearDatas();
                 _FunctionList = null;
             }
             catch (Exception ex)
@@ -452,14 +452,16 @@
         /// <summary>
         /// 娓呯┖璁惧鍔熻兘鍒楄〃
         /// </summary>
-        public void Clear()
+        public void ClearDatas()
         {
             try
             {
-                _IpCamImou.Clear();
-                _IpCamImou = null;
-                _FunctionList.Clear();
-                _FunctionList = null;
+                if (_IpCamImou != null)
+                {
+                    _IpCamImou.Clear();
+                    _IpCamImou = null;
+                }
+                _FunctionList = new FunctionList();
             }
             catch (Exception ex)
             {
diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs
index 2c95b5e..373106d 100644
--- a/HDL_ON/UI/MainPage.cs
+++ b/HDL_ON/UI/MainPage.cs
@@ -399,7 +399,7 @@
             {
                 try
                 {
-                    Entity.FunctionList.List.Clear();
+                    Entity.FunctionList.List.ClearDatas();
                     Entity.SpatialInfo.CurrentSpatial.Clear();
                     ///绛夊緟鑾峰彇浣忓畢淇℃伅
                     Application.RunOnMainThread(() =>
diff --git a/HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs b/HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs
index b228052..6a58a3e 100644
--- a/HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs
+++ b/HDL_ON/UI/UI0-Public/UpdataSidDataDialog.cs
@@ -32,7 +32,7 @@
             var functionOids = Newtonsoft.Json.JsonConvert.DeserializeObject<List<DeviceModule>>(obj.GetValue("objects").ToString());
             
             DB_ResidenceData.SaveOidList(oidJsonString);
-            FunctionList.List.Clear();
+            FunctionList.List.ClearDatas();
             foreach (var sidObj in sidObjects)
             {
                 var oid = functionOids.Find((o) =>  o.oid == sidObj.sid.Substring(0, 16));
diff --git a/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs b/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs
index 35a706a..25a9a06 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs
@@ -401,6 +401,10 @@
                     {
                         foreach (var scene in listScene)
                         {
+                            if(scene == null)
+                            {
+                                continue;
+                            }
                             if(scene.sceneType == SceneType.LightScene)
                             {
                                 continue;

--
Gitblit v1.8.0