From ee31aee3192d1235a87898708962e1f1f1c1650b Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 25 十月 2022 14:54:21 +0800 Subject: [PATCH] 智慧人居备份 --- HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs | 176 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 88 insertions(+), 88 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs index 4762bbb..167d25e 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs @@ -33,7 +33,7 @@ SensorDiyView sensorDiyView_Tvoc; SensorDiyView sensorDiyView_EleDay; SensorDiyView sensorDiyView_EleMonth; - SensorDiyView sensorDiyView_EleTotal; + SensorDiyView sensorDiyView_EleActivePower; #endregion /// <summary> /// 瀛愭帶鍖哄煙鍒楄〃 @@ -97,69 +97,71 @@ { return; } - if (basePage.sensorDiyView_Temp != null) - basePage.sensorDiyView_Temp.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.room_temp.ToString()).state); - if (basePage.sensorDiyView_Humi != null) - basePage.sensorDiyView_Humi.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.room_humidity.ToString()).state); - if (basePage.sensorDiyView_Pm25 != null) - basePage.sensorDiyView_Pm25.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.pm25.ToString()).state); - if (basePage.sensorDiyView_Co2 != null) - basePage.sensorDiyView_Co2.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.co2.ToString()).state); - if (basePage.sensorDiyView_Tvoc != null) - basePage.sensorDiyView_Tvoc.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.tvoc.ToString()).state); - if (basePage.sensorDiyView_EleDay != null) - basePage.sensorDiyView_EleDay.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.day_electricity.ToString()).state); - if (basePage.sensorDiyView_EleMonth != null) - basePage.sensorDiyView_EleMonth.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.month_electricity.ToString()).state); - if (basePage.sensorDiyView_EleTotal != null) - basePage.sensorDiyView_EleTotal.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.total_electricity.ToString()).state); - - - basePage.btnModeControl.IsSelected = basePage.btnWorkSceneControl.IsSelected = basePage.btnPowerControl.IsSelected = temp.trait_on_off.state == "on"; - - switch (temp.GetAttrState("mode")) + Application.RunOnMainThread(() => { - case "cool"://鍒跺喎 - basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeCoolIcon2.png"; - basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeCoolIcon2.png"; - break; - case "heat"://鍒剁儹 - basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHeatIcon2.png"; - basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHeatIcon2.png"; - break; - case "fan"://閫氶 - basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeFanIcon2.png"; - basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeFanIcon2.png"; - break; - case "dry"://闄ゆ箍 - basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeDeHumiIcon2.png"; - basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeDeHumiIcon2.png"; - break; - case "humidity"://鍔犳箍 - basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHumiIcon2.png"; - basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHumiIcon2.png"; - break; - case "heat_humidity"://鍒剁儹鍔犳箍 - basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHeatHumiIcon2.png"; - basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHeatHumiIcon2.png"; - break; - } - switch (temp.GetAttrState("scene")) - { - case "at_home"://鍦ㄥ - basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneAtHome2.png"; - basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeCoolIcon2.png"; - break; - case "leave_home"://绂诲 - basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneAwayHomeIcon2.png"; - basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneAwayHomeIcon2.png"; - break; - case "sleep"://鐫$湢 - basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneSleepIcon2.png"; - basePage.btnModeControl.UnSelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneSleepIcon2.png"; - break; - } + if (basePage.sensorDiyView_Temp != null) + basePage.sensorDiyView_Temp.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.room_temp.ToString()).state); + if (basePage.sensorDiyView_Humi != null) + basePage.sensorDiyView_Humi.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.room_humidity.ToString()).state); + if (basePage.sensorDiyView_Pm25 != null) + basePage.sensorDiyView_Pm25.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.pm25.ToString()).state); + if (basePage.sensorDiyView_Co2 != null) + basePage.sensorDiyView_Co2.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.co2.ToString()).state); + if (basePage.sensorDiyView_Tvoc != null) + basePage.sensorDiyView_Tvoc.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.tvoc.ToString()).state); + if (basePage.sensorDiyView_EleDay != null) + basePage.sensorDiyView_EleDay.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.day_electricity.ToString()).state); + if (basePage.sensorDiyView_EleMonth != null) + basePage.sensorDiyView_EleMonth.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.month_electricity.ToString()).state); + if (basePage.sensorDiyView_EleActivePower != null) + basePage.sensorDiyView_EleActivePower.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.active_power.ToString()).state); + + + switch (temp.GetAttrState("mode")) + { + case "cool"://鍒跺喎 + basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeCoolIcon2.png"; + basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeCoolIcon2.png"; + break; + case "heat"://鍒剁儹 + basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHeatIcon2.png"; + basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHeatIcon2.png"; + break; + case "fan"://閫氶 + basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeFanIcon2.png"; + basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeFanIcon2.png"; + break; + case "dry"://闄ゆ箍 + basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeDeHumiIcon2.png"; + basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeDeHumiIcon2.png"; + break; + case "humidity"://鍔犳箍 + basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHumiIcon2.png"; + basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHumiIcon2.png"; + break; + case "heat_humidity"://鍒剁儹鍔犳箍 + basePage.btnModeControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/ModeHeatHumiIcon2.png"; + basePage.btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/ModeHeatHumiIcon2.png"; + break; + } + switch (temp.GetAttrState("scene")) + { + case "at_home"://鍦ㄥ + basePage.btnWorkSceneControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneAtHome2.png"; + basePage.btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneAtHome2.png"; + break; + case "leave_home"://绂诲 + basePage.btnWorkSceneControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneAwayHomeIcon2.png"; + basePage.btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneAwayHomeIcon2.png"; + break; + case "sleep"://鐫$湢 + basePage.btnWorkSceneControl.UnSelectedImagePath = "FunctionIcon/Acst/grey/SceneSleepIcon2.png"; + basePage.btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{basePage.imageFolder}/SceneSleepIcon2.png"; + break; + } + basePage.btnModeControl.IsSelected = basePage.btnWorkSceneControl.IsSelected = basePage.btnPowerControl.IsSelected = temp.trait_on_off.state == "on"; + }); } @@ -395,28 +397,33 @@ if (tempObj != null) { - sensorDiyView_Temp = new SensorDiyView(sensorListView, curColor, tempObj.state == "" ? "--" : tempObj.state + "掳", "娓╁害"); + sensorDiyView_Temp = new SensorDiyView(sensorListView, curColor, tempObj.state == "" ? "--" : tempObj.state, "掳", "娓╁害"); } if (humiObj != null) { - sensorDiyView_Humi = new SensorDiyView(sensorListView, curColor, humiObj.state == "" ? "--" : humiObj.state + "%", "婀垮害"); + sensorDiyView_Humi = new SensorDiyView(sensorListView, curColor, humiObj.state == "" ? "--" : humiObj.state, "%", "婀垮害"); } if (pm25Obj != null) { - sensorDiyView_Pm25 = new SensorDiyView(sensorListView, curColor, pm25Obj.state == "" ? "--" : pm25Obj.state, "PM2.5"); + sensorDiyView_Pm25 = new SensorDiyView(sensorListView, curColor, pm25Obj.state == "" ? "--" : pm25Obj.state, "", "PM2.5"); } if (co2Obj != null) { - sensorDiyView_Co2 = new SensorDiyView(sensorListView, curColor, co2Obj.state == "" ? "--" : co2Obj.state, "CO2"); + sensorDiyView_Co2 = new SensorDiyView(sensorListView, curColor, co2Obj.state == "" ? "--" : co2Obj.state, "", "CO2"); } if (tvocObj != null) { - sensorDiyView_Tvoc = new SensorDiyView(sensorListView, curColor, tvocObj.state == "" ? "--" : tvocObj.state, "TVOC"); + sensorDiyView_Tvoc = new SensorDiyView(sensorListView, curColor, tvocObj.state == "" ? "--" : tvocObj.state, "", "TVOC"); } #endregion #region 鑳借�楁暟鎹� int energyCount = 0; + var totalObj = function.GetAttribute(AcstParent_AttrEnum.active_power.ToString()); + if (totalObj != null) + { + energyCount++; + } var dayObj = function.GetAttribute(AcstParent_AttrEnum.day_electricity.ToString()); if (dayObj != null) { @@ -424,11 +431,6 @@ } var monthObj = function.GetAttribute(AcstParent_AttrEnum.month_electricity.ToString()); if (monthObj != null) - { - energyCount++; - } - var totalObj = function.GetAttribute(AcstParent_AttrEnum.total_electricity.ToString()); - if (totalObj != null) { energyCount++; } @@ -440,17 +442,17 @@ Visible = false, }; infoContentView.AddChidren(energyListView); + if (totalObj != null) + { + sensorDiyView_EleActivePower = new SensorDiyView(energyListView, curColor, totalObj.state == "" ? "--" : totalObj.state , "KW", "鐢ㄧ數鍔熺巼", 100); + } if (dayObj != null) { - sensorDiyView_EleDay = new SensorDiyView(energyListView, curColor, dayObj.state == "" ? "--" : dayObj.state + "KW", "浠婃棩鑰楃數",100); + sensorDiyView_EleDay = new SensorDiyView(energyListView, curColor, dayObj.state == "" ? "--" : dayObj.state , "KW", "浠婃棩鑰楃數",100); } if (monthObj != null) { - sensorDiyView_EleMonth = new SensorDiyView(energyListView, curColor, monthObj.state == "" ? "--" : monthObj.state + "KWh", "鏈湀鑰楃數", 100); - } - if (totalObj != null) - { - sensorDiyView_EleTotal = new SensorDiyView(energyListView, curColor, totalObj.state == "" ? "--" : totalObj.state + "KWh", "鎬昏�楃數閲�", 100); + sensorDiyView_EleMonth = new SensorDiyView(energyListView, curColor, monthObj.state == "" ? "--" : monthObj.state , "KWh", "鏈湀鑰楃數", 100); } var btnChangeClick = new Button(); @@ -551,7 +553,7 @@ subViewList.Add(sub.sid, subFunctionView); - + Control.Ins.SendReadCommand(sub); subFunctionCount++; } @@ -998,12 +1000,9 @@ #endregion - - - - - InitGetWeatherAction(); + + Control.Ins.SendReadCommand(function); } @@ -1020,9 +1019,11 @@ private Button btnValue; private Button btnText; public string Tag; + public string unitString; - public SensorDiyView(HorizontalScrolViewLayout view,uint color,string value,string text,int setWidth = 60) + public SensorDiyView(HorizontalScrolViewLayout view,uint color,string value,string unitStr,string text,int setWidth = 60) { + unitString = unitStr; if (string.IsNullOrEmpty(value)) { value = "--"; @@ -1045,7 +1046,7 @@ TextAlignment = TextAlignment.Center, TextColor = color, TextSize = 20, - Text = value, + Text = value + unitString, }; contentView.AddChidren(btnValue); @@ -1063,7 +1064,7 @@ public void UpdateValue(string value) { - btnText.Text = value; + btnValue.Text = value + unitString; } } @@ -1176,7 +1177,6 @@ btnRoomInfo.MouseUpEventHandler = eventHandler; btnSubHumidityIcon.MouseUpEventHandler = eventHandler; btnSubHumidityValues.MouseUpEventHandler = eventHandler; - btnSubPower.MouseUpEventHandler = eventHandler; btnSubTempIcon.MouseUpEventHandler = eventHandler; btnSubTempValues.MouseUpEventHandler = eventHandler; subFunctionView.MouseUpEventHandler = eventHandler; -- Gitblit v1.8.0