From 50ad482974a7e838d11360a84e9e8ff3f7974ab2 Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期六, 12 十月 2024 09:34:01 +0800
Subject: [PATCH] 金茂问题修复

---
 HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs |   78 +++++++++++++++++++++-----------------
 1 files changed, 43 insertions(+), 35 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs
index f004fbf..12876b2 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstSubPage.cs
@@ -13,10 +13,13 @@
 
         Button btnTempValues;
         Button btnHumiValues;
+        Button btnTempValuesUint;
+        Button btnHumiValuesUint;
 
         Button btnSetTempValues;
         DiyImageSeekBar tempBar;
         Button btnPowerControl;
+        Button btnSetTempUnit;
 
         Function function;
 
@@ -27,14 +30,15 @@
 
         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;
@@ -44,6 +48,7 @@
                     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);
@@ -87,6 +92,7 @@
                     break;
             }
             bodyView = this;
+            BackgroundColor = CSS_Color.BackgroundColor;
         }
 
         public void LoadPage(Action action)
@@ -119,68 +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,
+                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 = function.GetAttrState(AcstSub_AttrEnum.room_humidity.ToString(),"---"),
-                TextAlignment = TextAlignment.TopRight,
+                TextAlignment = TextAlignment.TopCenter,
+                Width = Application.GetRealWidth(130),
             };
-            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 = "%"
@@ -221,15 +227,17 @@
                 Text = setTempStr
             };
             contentView.AddChidren(btnSetTempValues);
-            //bodyView.btnSetTempValues.Width = bodyView.btnSetTempValues.GetTextWidth() + Application.GetRealWidth(10);
+#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,
@@ -237,8 +245,6 @@
                 TextAlignment = TextAlignment.TopLeft,
             };
             contentView.AddChidren(btnSetTempUnit);
-
-
 
             var btnMinValuesText = new Button()
             {
@@ -253,10 +259,6 @@
             };
             contentView.AddChidren(btnMinValuesText);
 
-
-            int progress = 0;
-            int.TryParse(function.GetAttrState(FunctionAttributeKey.SetTemp),out progress);
-
             tempBar = new DiyImageSeekBar()
             {
                 Gravity = Gravity.CenterHorizontal,
@@ -268,7 +270,7 @@
                 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,
@@ -279,6 +281,12 @@
             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(() => {

--
Gitblit v1.8.0