From ab05fa182c317b62ff8b61489aac86162fab9e25 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 19 十月 2022 17:13:13 +0800 Subject: [PATCH] 人居环境更新 --- HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubHistoryPage.cs | 125 +++++++++++++----------- HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs | 19 +++ HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs | 133 +++++++++++++------------- 3 files changed, 152 insertions(+), 125 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs index 4762bbb..2178573 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs @@ -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_EleTotal != null) + basePage.sensorDiyView_EleTotal.UpdateValue(temp.GetAttribute(AcstParent_AttrEnum.total_electricity.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"; + }); } @@ -551,7 +553,7 @@ subViewList.Add(sub.sid, subFunctionView); - + Control.Ins.SendReadCommand(sub); subFunctionCount++; } @@ -998,13 +1000,10 @@ #endregion - - - - - InitGetWeatherAction(); + Control.Ins.SendReadCommand(function); + } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubHistoryPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubHistoryPage.cs index f7055ad..eb0b3db 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubHistoryPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubHistoryPage.cs @@ -179,62 +179,64 @@ #if DEBUG - List<string> vs = new List<string>() { - "1","2","3","4","5","6","7","8","9","10","11","12","13","14" - }; - tempEchartOption.InitXdataText(vs); - tempEchartOption.InitYdataText("yData", new List<EnvironmentalSensorHistor>() { - new EnvironmentalSensorHistor{ fieldName = "1", fieldValue= "23" }, - new EnvironmentalSensorHistor{ fieldName = "2", fieldValue= "22" }, - new EnvironmentalSensorHistor{ fieldName = "3", fieldValue= "-11" }, - new EnvironmentalSensorHistor{ fieldName = "4", fieldValue= "21" }, - new EnvironmentalSensorHistor{ fieldName = "5", fieldValue= "-41" }, - new EnvironmentalSensorHistor{ fieldName = "6", fieldValue= "23" }, - new EnvironmentalSensorHistor{ fieldName = "7", fieldValue= "-31" }, - new EnvironmentalSensorHistor{ fieldName = "8", fieldValue= "-23" }, - new EnvironmentalSensorHistor{ fieldName = "9", fieldValue= "-11" }, - new EnvironmentalSensorHistor{ fieldName = "10", fieldValue= "-21" }, - new EnvironmentalSensorHistor{ fieldName = "11", fieldValue= "24" }, - new EnvironmentalSensorHistor{ fieldName = "12", fieldValue= "41" }, - new EnvironmentalSensorHistor{ fieldName = "13", fieldValue= "32" }, - new EnvironmentalSensorHistor{ fieldName = "14", fieldValue= "23" } - }, "#FF9D54"); - tempEchartOption.yTitle = "娓╁害 (掳)"; - tempEchartOption.xTitle = ""; - var opString = tempEchartOption.InitOption(); - tempEchartsView.ShowWithOption(opString); + //List<string> vs = new List<string>() { + // "1","2","3","4","5","6","7","8","9","10","11","12","13","14" + // }; + //tempEchartOption.InitXdataText(vs); + //tempEchartOption.InitYdataText("yData", new List<EnvironmentalSensorHistor>() { + // new EnvironmentalSensorHistor{ fieldName = "1", fieldValue= "23" }, + // new EnvironmentalSensorHistor{ fieldName = "2", fieldValue= "22" }, + // new EnvironmentalSensorHistor{ fieldName = "3", fieldValue= "-11" }, + // new EnvironmentalSensorHistor{ fieldName = "4", fieldValue= "21" }, + // new EnvironmentalSensorHistor{ fieldName = "5", fieldValue= "-41" }, + // new EnvironmentalSensorHistor{ fieldName = "6", fieldValue= "23" }, + // new EnvironmentalSensorHistor{ fieldName = "7", fieldValue= "-31" }, + // new EnvironmentalSensorHistor{ fieldName = "8", fieldValue= "-23" }, + // new EnvironmentalSensorHistor{ fieldName = "9", fieldValue= "-11" }, + // new EnvironmentalSensorHistor{ fieldName = "10", fieldValue= "-21" }, + // new EnvironmentalSensorHistor{ fieldName = "11", fieldValue= "24" }, + // new EnvironmentalSensorHistor{ fieldName = "12", fieldValue= "41" }, + // new EnvironmentalSensorHistor{ fieldName = "13", fieldValue= "32" }, + // new EnvironmentalSensorHistor{ fieldName = "14", fieldValue= "23" } + //}, "#FF9D54"); + //tempEchartOption.yTitle = "娓╁害 (掳)"; + //tempEchartOption.xTitle = ""; + //var opString = tempEchartOption.InitOption(); + //tempEchartsView.ShowWithOption(opString); - List<string> vs2 = new List<string>() { - "1","2","3","4","5","6","7","8","9","10","11","12","13","14" - }; - humiEchartsOption.InitXdataText(vs2); - humiEchartsOption.InitYdataText("yData", new List<EnvironmentalSensorHistor>() { - new EnvironmentalSensorHistor{ fieldName = "1", fieldValue= "23" }, - new EnvironmentalSensorHistor{ fieldName = "2", fieldValue= "22" }, - new EnvironmentalSensorHistor{ fieldName = "3", fieldValue= "-11" }, - new EnvironmentalSensorHistor{ fieldName = "4", fieldValue= "21" }, - new EnvironmentalSensorHistor{ fieldName = "5", fieldValue= "-41" }, - new EnvironmentalSensorHistor{ fieldName = "6", fieldValue= "23" }, - new EnvironmentalSensorHistor{ fieldName = "7", fieldValue= "-31" }, - new EnvironmentalSensorHistor{ fieldName = "8", fieldValue= "-23" }, - new EnvironmentalSensorHistor{ fieldName = "9", fieldValue= "-11" }, - new EnvironmentalSensorHistor{ fieldName = "10", fieldValue= "-21" }, - new EnvironmentalSensorHistor{ fieldName = "11", fieldValue= "24" }, - new EnvironmentalSensorHistor{ fieldName = "12", fieldValue= "41" }, - new EnvironmentalSensorHistor{ fieldName = "13", fieldValue= "32" }, - new EnvironmentalSensorHistor{ fieldName = "14", fieldValue= "23" } - }, "#FF9D54"); - humiEchartsOption.yTitle = "婀垮害 (%)"; - humiEchartsOption.xTitle = ""; - var opString2 = humiEchartsOption.InitOption(); + //List<string> vs2 = new List<string>() { + // "1","2","3","4","5","6","7","8","9","10","11","12","13","14" + // }; + //humiEchartsOption.InitXdataText(vs2); + //humiEchartsOption.InitYdataText("yData", new List<EnvironmentalSensorHistor>() { + // new EnvironmentalSensorHistor{ fieldName = "1", fieldValue= "23" }, + // new EnvironmentalSensorHistor{ fieldName = "2", fieldValue= "22" }, + // new EnvironmentalSensorHistor{ fieldName = "3", fieldValue= "-11" }, + // new EnvironmentalSensorHistor{ fieldName = "4", fieldValue= "21" }, + // new EnvironmentalSensorHistor{ fieldName = "5", fieldValue= "-41" }, + // new EnvironmentalSensorHistor{ fieldName = "6", fieldValue= "23" }, + // new EnvironmentalSensorHistor{ fieldName = "7", fieldValue= "-31" }, + // new EnvironmentalSensorHistor{ fieldName = "8", fieldValue= "-23" }, + // new EnvironmentalSensorHistor{ fieldName = "9", fieldValue= "-11" }, + // new EnvironmentalSensorHistor{ fieldName = "10", fieldValue= "-21" }, + // new EnvironmentalSensorHistor{ fieldName = "11", fieldValue= "24" }, + // new EnvironmentalSensorHistor{ fieldName = "12", fieldValue= "41" }, + // new EnvironmentalSensorHistor{ fieldName = "13", fieldValue= "32" }, + // new EnvironmentalSensorHistor{ fieldName = "14", fieldValue= "23" } + //}, "#FF9D54"); + //humiEchartsOption.yTitle = "婀垮害 (%)"; + //humiEchartsOption.xTitle = ""; + //var opString2 = humiEchartsOption.InitOption(); - humiEchartsView.ShowWithOption(opString2); + //humiEchartsView.ShowWithOption(opString2); #endif + LoadEvent_ChangeSensorHistoryShowType(); + LoadMothed_GetHistoryData(); } @@ -247,6 +249,8 @@ btnShowHistroyData_Month.IsSelected = false; btnShowHistroyData_Week.IsSelected = false; curQueryType = "hour"; + tempEchartOption.YvalueText = ""; + humiEchartsOption.YvalueText = ""; LoadMothed_GetHistoryData(); }; @@ -257,6 +261,8 @@ btnShowHistroyData_Month.IsSelected = true; btnShowHistroyData_Week.IsSelected = false; curQueryType = "month"; + tempEchartOption.YvalueText = ""; + humiEchartsOption.YvalueText = ""; LoadMothed_GetHistoryData(); }; btnShowHistroyData_Week.MouseUpEventHandler = (sender, e) => @@ -266,6 +272,8 @@ btnShowHistroyData_Month.IsSelected = false; btnShowHistroyData_Week.IsSelected = true; curQueryType = "week"; + tempEchartOption.YvalueText = ""; + humiEchartsOption.YvalueText = ""; LoadMothed_GetHistoryData(); }; @@ -303,7 +311,7 @@ loadPage.Start(Language.StringByID(StringId.PleaseWait)); }); - var revertObj = new HttpServerRequest().GetSensorHistory( function.deviceId, curQueryType , "room_temp"); + var revertObj = new HttpServerRequest().GetSensorHistory(curQueryType, function.deviceId , "room_temp"); if (revertObj != null) { if (revertObj.Code == StateCode.SUCCESS) @@ -320,15 +328,16 @@ tempEchartOption.InitXdataText(vs); } tempEchartOption.InitYdataText("", revertData, "#FF80AEFF"); + + tempEchartOption.xTitle = Language.StringByID(StringId.timeMode); + var opString = tempEchartOption.InitOption(); + + Application.RunOnMainThread(() => + { + tempEchartsView.ShowWithOption(opString); + }); } } - tempEchartOption.xTitle = Language.StringByID(StringId.timeMode); - var opString = tempEchartOption.InitOption(); - - Application.RunOnMainThread(() => - { - tempEchartsView.ShowWithOption(opString); - }); } catch (Exception ex) { @@ -336,6 +345,7 @@ } finally { + inReadTempHistory = false; if (!inReadHumiHistory) { Application.RunOnMainThread(() => @@ -357,7 +367,7 @@ loadPage.Start(Language.StringByID(StringId.PleaseWait)); }); - var revertObj = new HttpServerRequest().GetSensorHistory(function.deviceId, curQueryType, "room_humidity"); + var revertObj = new HttpServerRequest().GetSensorHistory(curQueryType,function.deviceId, "room_humidity"); if (revertObj != null) { if (revertObj.Code == StateCode.SUCCESS) @@ -390,6 +400,7 @@ } finally { + inReadHumiHistory = false; if (!inReadTempHistory) { Application.RunOnMainThread(() => diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs index c6052de..90f1464 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs @@ -33,6 +33,13 @@ Application.RunOnMainThread(() => { bodyView.btnTempValues.Text = temp.GetAttrState(AcstSub_AttrEnum.room_temp.ToString()); bodyView.btnHumiValues.Text = temp.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString()); + + + int setTempValue = 0; + int.TryParse(temp.GetAttrState(AcstSub_AttrEnum.set_temp.ToString(), "--"), out setTempValue); + if (setTempValue != 0) + bodyView.btnSetTempValues.Text = setTempValue.ToString(); + bodyView.btnSetTempValues.Width = bodyView.btnSetTempValues.GetTextWidth() + Application.GetRealWidth(10); int progress = 0; @@ -197,6 +204,13 @@ Text = function.GetAttrState(AcstSub_AttrEnum.set_temp.ToString(), "--") }; contentView.AddChidren(btnSetTempValues); + int setTempValue = 0; + int.TryParse(function.GetAttrState(AcstSub_AttrEnum.set_temp.ToString(), "--"), out setTempValue); + if (setTempValue != 0) + btnSetTempValues.Text = setTempValue.ToString(); + bodyView.btnSetTempValues.Width = bodyView.btnSetTempValues.GetTextWidth() + Application.GetRealWidth(10); + + var btnSetTempUnit = new Button() { @@ -245,7 +259,8 @@ SeekBarPadding = Application.GetRealWidth(20), IsProgressTextShow = false, ProgressChangeDelayTime = 0, - IsOffline = function.trait_on_off.curValue.ToString() == "off", + Enable = function.trait_on_off.curValue.ToString() == "off", + //IsOffline = function.trait_on_off.curValue.ToString() == "off", }; contentView.AddChidren(tempBar); tempBar.OnProgressChangedEvent = (sender, e) => { @@ -301,6 +316,8 @@ { IsBackground = true }.Start(); }; + Control.Ins.SendReadCommand(function); + } } } -- Gitblit v1.8.0