From a9d1161b1df96e7ddad566335989a1444e433ef5 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期二, 28 三月 2023 11:54:45 +0800 Subject: [PATCH] 2023年03月28日11:52:02 --- HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs | 148 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 141 insertions(+), 7 deletions(-) diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs b/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs index 5a6a5d3..ffd324b 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs @@ -1,5 +1,6 @@ 锘縰sing System; using HDL_ON.Entity; +using HDL_ON.UI.CSS; using Shared; namespace HDL_ON.UI @@ -16,14 +17,14 @@ /// <param name="updataFunction"></param> public void UpdataStates(Function updataFunction, FrameLayout view, VerticalScrolViewLayout scrolView, Room room = null) { - Application.RunOnMainThread((Action)(() => + if (view == null || scrolView == null || updataFunction == null) + { + return; + } + Application.RunOnMainThread((() => { try { - if (view == null || scrolView == null || updataFunction == null) - { - return; - } if (!scrolView.ScrollEnabled) { return; @@ -111,6 +112,12 @@ { #region 绐楀笜鏇存柊 var onoffString = updataFunction.GetAttrState(FunctionAttributeKey.OnOff); + var percentAttr = updataFunction.GetAttribute(FunctionAttributeKey.Percent); + if(percentAttr != null) + { + onoffString = percentAttr.curValue.ToString() == "0" ? "off" : "on"; + } + if (onoffString == "stop") { return; @@ -156,12 +163,12 @@ else if (SPK.MusicSpkList().Contains(updataFunction.spk)) { #region 闊充箰鏇存柊 - var uMusic = updataFunction as Music.A31MusicModel; + var uMusic = updataFunction; if (cTag == updataFunction.spk + "_State_" + updataFunction.sid) { try { - (fcView.GetChildren(j) as Button).IsSelected = uMusic.A31PlayStatus.status == "play"; + (fcView.GetChildren(j) as Button).IsSelected = uMusic.GetAttrState("on_off") == "on"; } catch (Exception ex) { @@ -169,6 +176,89 @@ } } #endregion + } + //鏇存柊姣背娉紶鎰熷櫒鐘舵�� + else if(SPK.SenesorMegahealth == updataFunction.spk || SPK.SensorMmvPose == updataFunction.spk) + { + if (cTag == updataFunction.sid + "_SenesorMegahealth_Status") + { + try + { + Button btnStatus = (fcView.GetChildren(j) as Button); + + var tempStatus = updataFunction.attributes.Find((sta) => sta.key == FunctionAttributeKey.TargetStatus); + if (tempStatus != null) + { + + switch (tempStatus.state) + {//0绌猴紝1璧帮紝2璺戯紝3鍧愶紝4璺屽�掞紝5绔� + case "0": + btnStatus.TextID = StringId.SensorNormalState; + btnStatus.TextColor = CSS_Color.MainColor; + break; + case "1": + btnStatus.TextID = StringId.SomeoneIn; + break; + case "2": + if (updataFunction.extSet.labModel) + { + btnStatus.TextID = StringId.SomeoneRunning; + } + else + { + btnStatus.TextID = StringId.Someone; + } + btnStatus.TextColor = CSS_Color.WarningColor; + break; + case "3": + if (updataFunction.extSet.labModel) + { + btnStatus.TextID = StringId.SomeoneSitting; + } + else + { + btnStatus.TextID = StringId.Someone; + } + btnStatus.TextColor = CSS_Color.WarningColor; + break; + case "4": + btnStatus.TextID = StringId.SomeoneFell; + btnStatus.TextColor = CSS_Color.WarningColor; + break; + case "5": + if (updataFunction.extSet.labModel) + { + btnStatus.TextID = StringId.SomeoneStanding; + } + else + { + btnStatus.TextID = StringId.Someone; + } + btnStatus.TextColor = CSS_Color.WarningColor; + break; + } + + } + + + } + catch (Exception ex) + { + MainPage.Log($"{this.GetType()} error 3 : {ex.Message}"); + } + } + } + //鏇存柊娓╂帶鍣ㄧ姸鎬� + else if(SPK.HvacCac == updataFunction.spk) + { + if (cTag == updataFunction.sid + "_Humidity") + { + (fcView.GetChildren(j) as Button).Text = updataFunction.GetAttrState(FunctionAttributeKey.RoomHumidity) + "%"; + } + else if (cTag == updataFunction.sid + "_Temp") + { + (fcView.GetChildren(j) as Button).Text = updataFunction.GetAttrState(FunctionAttributeKey.RoomTemp) + "掳C"; + } } } } @@ -181,5 +271,49 @@ } })); } + + public void UpdataOnlineStatus(Function updataFunction, FrameLayout view, VerticalScrolViewLayout scrolView, Room room = null) + { + Application.RunOnMainThread(() => + { + try + { + if (view == null || scrolView == null || updataFunction == null) + { + return; + } + if (!scrolView.ScrollEnabled) + { + return; + } + if (room != null) + { + if (!updataFunction.roomIds.Contains(room.roomId)) + { + return; + } + } + for (int i = 0; i < scrolView.ChildrenCount; i++) + { + if (scrolView.GetChildren(i).Tag == null || scrolView.GetChildren(i).Tag.ToString() == "") + { + continue; + } + var viewTag = scrolView.GetChildren(i).Tag.ToString(); + if (scrolView.GetChildren(i).Tag != null && viewTag == updataFunction.spk + updataFunction.sid) + { + if (scrolView.GetChildren(i).GetType() == typeof(FunctionControlZone)) { + var fcView = scrolView.GetChildren(i) as FunctionControlZone; + fcView.UpdataOnline(updataFunction.online); + } + } + } + }catch (Exception ex) + { + MainPage.Log("Function Online status error : " + ex.Message); + } + }); + } + } } \ No newline at end of file -- Gitblit v1.8.0