From a40848272e33822f72a7fe0310f079717bf73f23 Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期五, 18 十月 2024 16:21:39 +0800 Subject: [PATCH] 修复金茂科技系统,金茂光伏问题 --- HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs | 137 +++++++++++++++++++++++++-------------------- 1 files changed, 75 insertions(+), 62 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs index f6a5fbd..12876b2 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs @@ -13,27 +13,32 @@ Button btnTempValues; Button btnHumiValues; + Button btnTempValuesUint; + Button btnHumiValuesUint; Button btnSetTempValues; DiyImageSeekBar tempBar; Button btnPowerControl; + Button btnSetTempUnit; Function function; uint curColor; + string colorString; string imageFolder = "blue"; public static void UpdateStatus(Function temp) { - if(bodyView == null) + if(bodyView == null || bodyView.function.sid != temp.sid) { return; } Application.RunOnMainThread(() => { bodyView.btnTempValues.Text = temp.GetAttrState(AcstSub_AttrEnum.room_temp.ToString()); bodyView.btnHumiValues.Text = temp.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString()); - + bodyView.btnHumiValuesUint.X = (bodyView.btnHumiValues.GetTextWidth() + bodyView.btnHumiValues.Width) / 2; + bodyView.btnTempValuesUint.X = (bodyView.btnTempValues.GetTextWidth() + bodyView.btnTempValues.Width) / 2; int setTempValue = 0; double dd = 0; @@ -43,22 +48,25 @@ bodyView.btnSetTempValues.Text = setTempValue.ToString(); bodyView.btnSetTempValues.Width = bodyView.btnSetTempValues.GetTextWidth() + Application.GetRealWidth(10); + bodyView.btnSetTempUnit.X = bodyView.btnSetTempValues.Right; //int progress = 0; //int.TryParse(temp.GetAttrState(AcstSub_AttrEnum.set_temp.ToString()), out progress); - bodyView.tempBar.Progress = setTempValue - 16; + if (bodyView.tempBar.Progress != setTempValue - 16) + bodyView.tempBar.Progress = setTempValue - 16; if(temp.trait_on_off.curValue.ToString() == "on") { bodyView.btnPowerControl.IsSelected = true; bodyView.tempBar.ProgressBarColor = bodyView.curColor; - bodyView.tempBar.IsOffline = false; + //bodyView.tempBar.IsClickable = function.trait_on_off.curValue.ToString() == "off", + //bodyView.tempBar.IsOffline = false; } else { bodyView.btnPowerControl.IsSelected = false; bodyView.tempBar.ProgressBarColor = CSS_Color.DividingLineColor; - bodyView.tempBar.IsOffline = true; + //bodyView.tempBar.IsOffline = true; } }); @@ -71,21 +79,25 @@ switch (imageFolder) { case "blue": - curColor = CSS.CSS_Color.MainColor; + curColor = CSS_Color.MainColor; + colorString = "#4484F4"; break; case "orange": curColor = 0xFFFFB848; + colorString = "#FFB848"; break; case "purple": curColor = 0xFF9175F3; + colorString = "#9175F3"; break; } bodyView = this; + BackgroundColor = CSS_Color.BackgroundColor; } - public void LoadPage() + public void LoadPage(Action action) { - new TopViewDiv(bodyView, function.GetRoomListName()).LoadTopView(); + new TopViewDiv(bodyView, function.name).LoadTopView_FunctionTop(function,action); var contentView = new FrameLayout() { @@ -113,69 +125,68 @@ var tempValuesView = new FrameLayout() { X = Application.GetRealWidth(21), - Y = Application.GetRealWidth(17), + Y = Application.GetRealWidth(22), Width = Application.GetRealWidth(130), Height = Application.GetRealWidth(132), }; tempHumiView.AddChidren(tempValuesView); btnTempValues = new Button() { - Y = Application.GetRealWidth(45), - Height = Application.GetRealWidth(35), + Y = Application.GetRealWidth(38), + Height = Application.GetRealWidth(66), IsBold = true, TextSize = 30, TextColor = CSS.CSS_Color.FirstLevelTitleColor, - TextAlignment = TextAlignment.TopRight, - Text = "---", + TextAlignment = TextAlignment.TopCenter, + Text = function.GetAttrState(AcstSub_AttrEnum.room_temp.ToString(),"---"), + Width = Application.GetRealWidth(130), }; - btnTempValues.Text = function.GetAttrState(AcstSub_AttrEnum.room_temp.ToString()); - btnTempValues.Width = btnTempValues.GetTextWidth(); btnTempValues.Gravity = Gravity.CenterHorizontal; tempValuesView.AddChidren(btnTempValues); - var btnTempValuesUint = new Button() + + btnTempValuesUint = new Button() { - X = btnTempValues.Right, - Y = Application.GetRealWidth(48), + X = (btnTempValues.GetTextWidth() + btnTempValues.Width) / 2, + //Y = Application.GetRealWidth(48), + Y = Application.GetRealWidth(45), + Height = Application.GetRealWidth(66), TextAlignment = TextAlignment.TopLeft, Width = Application.GetRealWidth(30), - Height = Application.GetRealWidth(30), + //Height = Application.GetRealWidth(30), TextSize = 10, TextColor = CSS.CSS_Color.FirstLevelTitleColor, Text = "掳C" }; tempValuesView.AddChidren(btnTempValuesUint); - - var humiValuesView = new FrameLayout() { X = Application.GetRealWidth(130+21), - Y = Application.GetRealWidth(17), + Y = Application.GetRealWidth(22), Width = Application.GetRealWidth(130), Height = Application.GetRealWidth(132), }; tempHumiView.AddChidren(humiValuesView); btnHumiValues = new Button() { - Y = Application.GetRealWidth(45), - Height = Application.GetRealWidth(35), + Y = Application.GetRealWidth(39), + Height = Application.GetRealWidth(66), IsBold = true, TextSize = 30, TextColor = CSS.CSS_Color.FirstLevelTitleColor, - Text = "---", - TextAlignment = TextAlignment.TopRight, + Text = function.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString(),"---"), + TextAlignment = TextAlignment.TopCenter, + Width = Application.GetRealWidth(130), }; - btnHumiValues.Text = function.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString()); - btnHumiValues.Width = btnTempValues.GetTextWidth(); btnHumiValues.Gravity = Gravity.CenterHorizontal; humiValuesView.AddChidren(btnHumiValues); - var btnHumiValuesUint = new Button() + btnHumiValuesUint = new Button() { - X = btnTempValues.Right, - Y = Application.GetRealWidth(48), + X = (btnHumiValues.GetTextWidth() + btnHumiValues.Width) / 2, + Y = Application.GetRealWidth(45), TextAlignment = TextAlignment.TopLeft, Width = Application.GetRealWidth(30), - Height = Application.GetRealWidth(30), + Height = Application.GetRealWidth(66), TextSize = 10, TextColor = CSS.CSS_Color.FirstLevelTitleColor, Text = "%" @@ -184,7 +195,7 @@ EventHandler<MouseEventArgs> eventHandler = (sender, e) => { - var page = new AcstSubHistoryPage(function); + var page = new AcstSubHistoryPage(function, colorString); MainPage.BasePageView.AddChidren(page); page.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -196,34 +207,37 @@ #endregion - btnSetTempValues = new Button() - { - Gravity = Gravity.CenterHorizontal, - Y = Application.GetRealHeight(260), - Width = Application.GetRealWidth(77), - Height = Application.GetRealHeight(90), - TextAlignment = TextAlignment.TopRight, - TextColor = CSS.CSS_Color.FirstLevelTitleColor, - IsBold = true, - TextSize = 60, - Text = function.GetAttrState(AcstSub_AttrEnum.set_temp.ToString(), "--") - }; - contentView.AddChidren(btnSetTempValues); int setTempValue = 0; + string setTempStr = "--"; double dd = 0; double.TryParse(function.GetAttrState(AcstSub_AttrEnum.set_temp.ToString(), "--"), out dd); setTempValue = Convert.ToInt32(dd); if (setTempValue != 0) - btnSetTempValues.Text = setTempValue.ToString(); - //bodyView.btnSetTempValues.Width = bodyView.btnSetTempValues.GetTextWidth() + Application.GetRealWidth(10); + setTempStr = setTempValue.ToString(); + btnSetTempValues = new Button() + { + X = Application.GetRealWidth((375 - 77 -30)/2), + Y = Application.GetRealHeight(260), + Width = Application.GetRealWidth(73), + Height = Application.GetRealHeight(90), + TextAlignment = TextAlignment.TopCenter, + TextColor = CSS.CSS_Color.FirstLevelTitleColor, + IsBold = true, + TextSize = 60, + Text = setTempStr + }; + contentView.AddChidren(btnSetTempValues); +#if __IOS__ + btnSetTempValues.Width = btnSetTempValues.GetTextWidth() + Application.GetRealWidth(10); +#else + btnSetTempValues.Width = btnSetTempValues.GetTextWidth() + Application.GetRealWidth(5); +#endif - - - var btnSetTempUnit = new Button() + btnSetTempUnit = new Button() { X = btnSetTempValues.Right + Application.GetRealWidth(3), Y = Application.GetRealHeight(267), - Width = Application.GetRealWidth(30), + Width = Application.GetRealWidth(50), Height = Application.GetRealHeight(50), TextSize = 23, TextColor = CSS.CSS_Color.FirstLevelTitleColor, @@ -231,8 +245,6 @@ TextAlignment = TextAlignment.TopLeft, }; contentView.AddChidren(btnSetTempUnit); - - var btnMinValuesText = new Button() { @@ -247,10 +259,6 @@ }; contentView.AddChidren(btnMinValuesText); - - int progress = 0; - int.TryParse(function.GetAttrState(FunctionAttributeKey.SetTemp),out progress); - tempBar = new DiyImageSeekBar() { Gravity = Gravity.CenterHorizontal, @@ -262,16 +270,23 @@ ThumbImageHeight = Application.GetRealHeight(51), ProgressBarColor = function.trait_on_off.curValue.ToString() == "on" ? curColor : CSS_Color.DividingLineColor, MaxValue = 14, - Progress = progress + 16, + Progress = setTempValue - 16, SeekBarPadding = Application.GetRealWidth(20), IsProgressTextShow = false, ProgressChangeDelayTime = 0, + //IsClickable = function.trait_on_off.curValue.ToString() == "off", //Enable = function.trait_on_off.curValue.ToString() == "off", - //IsOffline = function.trait_on_off.curValue.ToString() == "off", + //IsOffline = true,// function.trait_on_off.curValue.ToString() == "off", }; contentView.AddChidren(tempBar); tempBar.OnProgressChangedEvent = (sender, e) => { btnSetTempValues.Text = (e + 16).ToString(); +#if __IOS__ + btnSetTempValues.Width = btnSetTempValues.GetTextWidth() + Application.GetRealWidth(10); +#else + btnSetTempValues.Width = btnSetTempValues.GetTextWidth() + Application.GetRealWidth(5); +#endif + btnSetTempUnit.X = btnSetTempValues.Right; }; tempBar.OnStopTrackingTouchEvent = (sender, e) => { new System.Threading.Thread(() => { @@ -295,8 +310,6 @@ TextSize = CSS_FontSize.PromptFontSize_FirstLevel, }; contentView.AddChidren(btnMaxValuesText); - - -- Gitblit v1.8.0