From 02498f7744e6fdc413e518f96b25f3635540dc6b Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 15 十一月 2022 11:27:38 +0800 Subject: [PATCH] 金茂科技系统更新 --- HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs | 116 +++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 74 insertions(+), 42 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs index cee8a68..714191b 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs @@ -16,7 +16,8 @@ { static AcstParentPage basePage; - VerticalScrolViewLayout bodyView; + VerticalScrolViewLayout contentView; + #region 澶╂皵鎺т欢 Button btnOutdoorTemp; @@ -66,8 +67,10 @@ basePage = this; this.function = FunctionList.List.GetAcstParentList()[0]; this.BackgroundColor = CSS.CSS_Color.BackgroundColor; - bodyView = new VerticalScrolViewLayout(); - this.AddChidren(bodyView); + contentView = new VerticalScrolViewLayout() { + Height = Application.GetRealHeight(667 - 56), + }; + this.AddChidren(contentView); subViewList = new Dictionary<string, AcstSubControlView>(); } /// <summary> @@ -232,7 +235,7 @@ Height = Application.GetRealHeight(180), BackgroundImagePath = $"FunctionIcon/Acst/{imageFolder}/TopViewBg.png", }; - bodyView.AddChidren(topView); + contentView.AddChidren(topView); var backView = new FrameLayout() { @@ -353,7 +356,7 @@ #endregion - bodyView.AddChidren(new Button + contentView.AddChidren(new Button { Height = Application.GetRealHeight(8), }); @@ -417,7 +420,7 @@ Height = Application.GetRealHeight(104), BackgroundColor = CSS.CSS_Color.MainBackgroundColor, }; - bodyView.AddChidren(infoView); + contentView.AddChidren(infoView); var infoContentView = new FrameLayout() { @@ -442,11 +445,21 @@ if (tempObj != null) { - sensorDiyView_Temp = new SensorDiyView(sensorListView, curColor, tempObj.state == "" ? "--" : tempObj.state, "掳", Language.StringByID(StringId.Temp)); + string tempValues = tempObj.state == "" ? "--" : tempObj.state; + if (tempValues.Contains(".")) + { + tempValues = tempValues.Remove(tempValues.IndexOf('.'), tempValues.Length - tempValues.IndexOf('.')); + } + sensorDiyView_Temp = new SensorDiyView(sensorListView, curColor, tempValues, "掳", Language.StringByID(StringId.Temp)); } if (humiObj != null) { - sensorDiyView_Humi = new SensorDiyView(sensorListView, curColor, humiObj.state == "" ? "--" : humiObj.state, "%", Language.StringByID(StringId.Humidity)); + string humiValues = humiObj.state == "" ? "--" : humiObj.state; + if (humiValues.Contains(".")) + { + humiValues = humiValues.Remove(humiValues.IndexOf('.'), humiValues.Length - humiValues.IndexOf('.')); + } + sensorDiyView_Humi = new SensorDiyView(sensorListView, curColor, humiValues , "%", Language.StringByID(StringId.Humidity)); } if (pm25Obj != null) { @@ -536,7 +549,7 @@ { Height = Application.GetRealHeight(54-11), }; - bodyView.AddChidren(subTitleView); + contentView.AddChidren(subTitleView); var btnCollection = new Button() { @@ -582,42 +595,53 @@ { Height = Application.GetRealHeight(88), }; - bodyView.AddChidren(subFunctionListView); + contentView.AddChidren(subFunctionListView); subFunctionListView.AddChidren(new Button { Width = Application.GetRealWidth(9) }); - foreach (var sub in FunctionList.List.GetAcstSubList()) + new System.Threading.Thread(() => { - if (subViewList.ContainsKey(sub.sid)) + try { - continue; - } - - if (subFunctionCount > 0 && subFunctionCount % 2 == 0) - { - subFunctionListView = new HorizontalScrolViewLayout() + foreach (var sub in FunctionList.List.GetAcstSubList()) { - Height = Application.GetRealHeight(93), - }; - bodyView.AddChidren(subFunctionListView); - subFunctionListView.AddChidren(new Button { Width = Application.GetRealWidth(9) }); + if (subViewList.ContainsKey(sub.sid)) + { + continue; + } + + Application.RunOnMainThread(() => + { + if (subFunctionCount > 0 && subFunctionCount % 2 == 0) + { + subFunctionListView = new HorizontalScrolViewLayout() + { + Height = Application.GetRealHeight(93), + }; + contentView.AddChidren(subFunctionListView); + subFunctionListView.AddChidren(new Button { Width = Application.GetRealWidth(9) }); + } + + AcstSubControlView subFunctionView = new AcstSubControlView(sub, subFunctionListView, imageFolder); + subViewList.Add(sub.sid, subFunctionView); + new System.Threading.Thread(() => + { + Control.Ins.SendReadCommand(sub); + }) + { IsBackground = true }.Start(); + subFunctionCount++; + }); + + System.Threading.Thread.Sleep(10); + } } - - AcstSubControlView subFunctionView = new AcstSubControlView(sub, subFunctionListView,imageFolder); - - subViewList.Add(sub.sid, subFunctionView); - - Control.Ins.SendReadCommand(sub); - - subFunctionCount++; - } - + catch { } + finally{ + + } + }).Start(); #endregion - bodyView.AddChidren(new Button() - { - Height = Application.GetRealHeight(72), - }); #region 搴曢儴鎺у埗鏍� var bottomView = new FrameLayout() @@ -1006,7 +1030,7 @@ Language.StringByID(StringId.AtHome), curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.at_home.ToString()); atHomeIconButton.Click(() => { - btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAtHome2.png"; + btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAtHome2.png"; dialog.Close(); new System.Threading.Thread(() => { @@ -1043,7 +1067,7 @@ Language.StringByID(StringId.AwayHome), curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.leave_home.ToString()); awayHomeIconButton.Click(() => { - btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAwayHomeIcon2.png"; + btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneAwayHomeIcon2.png"; dialog.Close(); new System.Threading.Thread(() => { @@ -1081,7 +1105,7 @@ Language.StringByID(StringId.Sleep), curColor, function.GetAttrState(AcstParent_AttrEnum.scene.ToString()) == AcstParent_Attr_SceneValueEnum.sleep.ToString()); sleepIconButton.Click(() => { - btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneSleepIcon2.png"; + btnWorkSceneControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/SceneSleepIcon2.png"; dialog.Close(); new System.Threading.Thread(() => { @@ -1105,7 +1129,11 @@ InitGetWeatherAction(); - Control.Ins.SendReadCommand(function); + new System.Threading.Thread(() => + { + Control.Ins.SendReadCommand(function); + }) + { IsBackground = true }.Start(); } @@ -1160,10 +1188,14 @@ TextAlignment = TextAlignment.Center, TextColor = 0xFF949AA5, TextSize = 12, - Text = text + "(" + unitString+")", + Text = text , }; contentView.AddChidren(btnText); + if(!string.IsNullOrEmpty(unitString)) + { + btnText.Text += "(" + unitString + ")"; + } } @@ -1174,7 +1206,7 @@ { value = value.Remove(value.IndexOf('.'), value.Length - value.IndexOf('.')); } - btnValue.Text = value + unitString; + btnValue.Text = value; } } -- Gitblit v1.8.0