From 4f2dbd1f6a1ec2d9c3c39b4a37b0b7c9ddece4aa Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期四, 23 九月 2021 15:24:01 +0800 Subject: [PATCH] 主页刷新优化 --- HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs | 67 ++++++++++++++++++++++----------- 1 files changed, 45 insertions(+), 22 deletions(-) diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs index 4a678e3..75cec12 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs @@ -30,21 +30,39 @@ /// </summary> public static void LoadEvent_RefreshSecurityStatus() { - Application.RunOnMainThread(() => + try { - if (bodyView != null) + Application.RunOnMainThread(() => { - //foreach(var temp in FunctionList.List.securities) - //{ - // if(temp.status == "enable") - // { - // bodyView.btnSecurityStatus.IsSelected = true; - // return; - // } - //} - bodyView.btnSecurityStatus.IsSelected = SecurityCenter.Ins.InDefense; - } - }); + if (bodyView != null) + { + lock (FunctionList.List.securities) + { + bodyView.btnSecurityStatus.IsSelected = false; + foreach (var temp in FunctionList.List.securities) + { + if (temp.status == "enable") + { + if (temp.alarm) + { + bodyView.btnSecurityStatus.SelectedImagePath = "Collection/DefenseAlarmIcon.png"; + } + else + { + bodyView.btnSecurityStatus.SelectedImagePath = "Collection/DefenseStatusIcon.png"; + } + bodyView.btnSecurityStatus.IsSelected = true; + return; + } + } + } + } + }); + } + catch (Exception ex) + { + MainPage.Log($"瀹夐槻涓婚〉鏇存柊寮傚父锛歿ex.Message}"); + } } /// <summary> @@ -248,7 +266,6 @@ btnChangeScene.IsBold = false; CurShowTypeIsFunction = true; contentView.PageIndex = 0; - }; //var client = new BlufiClient(); @@ -280,7 +297,6 @@ btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize; btnChangeScene.IsSelected = false; btnChangeScene.IsBold = false; - CurShowTypeIsFunction = true; } else { @@ -290,7 +306,6 @@ btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize; btnChangeFunction.IsSelected = false; btnChangeFunction.IsBold = false; - CurShowTypeIsFunction = false; } }; } @@ -314,7 +329,15 @@ if (function.spk == SPK.CurtainRoller || function.spk == SPK.CurtainShades || function.spk == SPK.CurtainTrietex || function.spk == SPK.CurtainSwitch)//绐楀笜璁惧鏍规嵁鐧惧垎姣斿垽鏂紑鍏崇姸鎬� { - state = function.GetAttrState(FunctionAttributeKey.Percent) != "0"; + if (function.GetAttribute(FunctionAttributeKey.Percent) != null) + { + state = function.GetAttrState(FunctionAttributeKey.Percent) != "0"; + }else + { + if (function.GetAttrState(FunctionAttributeKey.OnOff) == "stop") + return; + state = function.trait_on_off.curValue.ToString() == "on"; + } } else { @@ -618,12 +641,12 @@ { //鏈鐨勬秷鎭垪琛� var unreadList = new List<PushMessageInfo>(); + + var pushMessageInfoList = Newtonsoft.Json.JsonConvert.DeserializeObject<PushMessageInfoList>(result.Data.ToString()); - var pushMessageInfoList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PushMessageInfo>>(result.Data.ToString()); - - if (pushMessageInfoList != null && pushMessageInfoList.Count > 0) + if (pushMessageInfoList != null && pushMessageInfoList.list != null && pushMessageInfoList.list.Count > 0) { - foreach (var info in pushMessageInfoList) + foreach (var info in pushMessageInfoList.list) { if (!info.isRead) { @@ -643,7 +666,7 @@ { Application.RunOnMainThread(() => { - ShowMesBtnState(pushMessageInfoList[0], true); + ShowMesBtnState(pushMessageInfoList.list[0], true); }); } } -- Gitblit v1.8.0