From efcffde735fa65ae34bae0bcc86313b74ed0e36c Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期一, 20 五月 2024 13:47:38 +0800 Subject: [PATCH] 优化离线数据 --- HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs | 76 ++++++++++++++++++++++++++++++++----- 1 files changed, 65 insertions(+), 11 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs index 2aaa1dd..b630a7e 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs @@ -4,6 +4,7 @@ using HDL_ON.DAL.Server; using HDL_ON.Entity; using HDL_ON.UI.CSS; +using Newtonsoft.Json; using Shared; namespace HDL_ON.UI @@ -21,7 +22,9 @@ public void LoadPage() { - new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)).LoadTopView_AddIcon("CombinedDimming", + var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)); + topView.maginY = 10; + topView.LoadTopView_AddIcon("CombinedDimming", (s, c) => { try @@ -29,7 +32,10 @@ var page = new AddGroupControlPage(null, (newGC) => { - ReadGroupControlList(); + Application.RunOnMainThread(() => + { + LoadGroupControlView(); + }); }, () => { }); MainPage.BasePageView.AddChidren(page); page.LoadPage(); @@ -40,8 +46,8 @@ contentView = new VerticalScrolViewLayout() { - Y = Application.GetRealHeight(64), - Height = Application.GetRealHeight(667 - 64), + Y = Application.GetRealHeight(64+10), + Height = Application.GetRealHeight(667 - 64-10), BackgroundColor = CSS_Color.MainBackgroundColor, }; bodyView.AddChidren(contentView); @@ -71,8 +77,57 @@ { try { - FunctionList.List.groupControls.Clear(); - FunctionList.List.groupControls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString()); + //FunctionList.List.groupControls.Clear(); + //FunctionList.List.groupControls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString()); + + try + { + var groupControlList = JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString()); + var readSidList = new List<string>(); + foreach (var temp in groupControlList) + { + FunctionList.List.groupControls.Clear(); + readSidList.Add(temp.userDeviceGroupControlId); + if (readSidList.Count >= 20) + { + var data = ApiUtlis.Ins.HttpRequest.GetGroupControInfo(readSidList); + if (data != null) + { + if (data.Code == StateCode.SUCCESS) + { + var groupControlInfoList = JsonConvert.DeserializeObject<List<GroupControl>>(data.Data.ToString()); + FunctionList.List.groupControls.AddRange(groupControlInfoList); + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); + } + } + readSidList.Clear(); + } + } + if (readSidList.Count > 0) + { + var data = ApiUtlis.Ins.HttpRequest.GetGroupControInfo(readSidList); + if (data != null) + { + if (data.Code == StateCode.SUCCESS) + { + var groupControlInfoList = JsonConvert.DeserializeObject<List<GroupControl>>(data.Data.ToString()); + FunctionList.List.groupControls.AddRange(groupControlInfoList); + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); + } + } + readSidList.Clear(); + } + } + catch (Exception ex) + { + MainPage.Log($"璇诲彇缁勬帶鍒楄〃澶辫触:{ex.Message}"); + } Application.RunOnMainThread(() => { @@ -168,14 +223,13 @@ { Application.RunOnMainThread(() => { - //groupControl.roomIds = newGC.roomIds; - //groupControl.uids = newGC.uids; - var localTemp = FunctionList.List.groupControls.Find((obj) => obj.deviceId == newGC.deviceId); + var localTemp = FunctionList.List.groupControls.Find((obj) => obj.deviceId == newGC.deviceId); localTemp.roomIds = newGC.roomIds; localTemp.uids = newGC.uids; localTemp.sids = newGC.sids; - - btnFunctionLocationInfo.Text = newGC.GetUidListName(); + localTemp.name = newGC.name; + btnFunctionLocationInfo.Text = newGC.GetUidListName(); + btnFunctionName.Text = newGC.name; }); } } -- Gitblit v1.8.0