From 84115d8b6b58b4fcb7251811cb564eb5d2aa850d Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 04 十一月 2022 11:55:48 +0800
Subject: [PATCH] 组合调光

---
 HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs |  115 +++++++++++++++++++++++++++++++++------------------------
 1 files changed, 67 insertions(+), 48 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs
index 8f2b256..35898ed 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/AcstParentPage.cs
@@ -467,7 +467,7 @@
                 {
                     Width = Application.GetRealWidth(100 * energyCount),
                     Gravity = Gravity.Center,
-                    Visible = false,
+                    Visible = sensorCount == 0
                 };
                 if (energyCount > 0)
                 {
@@ -480,7 +480,6 @@
                     {
                         text = "Power";
                     }
-
                     sensorDiyView_EleActivePower = new SensorDiyView(energyListView, curColor, totalObj.state == "" ? "--" : totalObj.state, "KW", text, 100);
                 }
                 if (dayObj != null)
@@ -490,7 +489,7 @@
                     {
                         text = "Power of today";
                     }
-                    sensorDiyView_EleDay = new SensorDiyView(energyListView, curColor, dayObj.state == "" ? "--" : dayObj.state, "KW", text, 100);
+                    sensorDiyView_EleDay = new SensorDiyView(energyListView, curColor, dayObj.state == "" ? "--" : dayObj.state, "KWh", text, 100);
                 }
                 if (monthObj != null)
                 {
@@ -643,10 +642,10 @@
             bottomView.AddChidren(btnModeControl);
             btnModeControl.MouseUpEventHandler = (sender3, e3) =>
             {
-                if(function.trait_on_off.state == "off")
-                {
-                    return;
-                }
+                //if(function.trait_on_off.state == "off")
+                //{
+                //    return;
+                //}
                 Dialog dialog = new Dialog();
 
                 var dialogView = new FrameLayout();
@@ -675,7 +674,7 @@
                 {
                     X = Application.GetRealWidth(16),
                     Width = Application.GetRealWidth(100),
-                    TextID = StringId.SelectScene,
+                    TextID = StringId.SelectMode,
                     TextSize = 16,
                     TextColor = CSS.CSS_Color.FirstLevelTitleColor,
                     IsBold = true,
@@ -752,41 +751,6 @@
                     heatView.AddChidren(heatIconButton);
                     #endregion
                 }
-                if (function.GetAttribute(AcstParent_AttrEnum.mode.ToString()).value.Contains(AcstParent_Attr_ModeValueEnum.humidity.ToString()))
-                {
-
-                    #region 闄ゆ箍
-                    var dehumiView = new FrameLayout()
-                    {
-                        X = Application.GetRealWidth(2),
-                        Width = Application.GetRealWidth(144),
-                        Height = Application.GetRealHeight(44),
-                    };
-                    dialogContentView.AddChidren(dehumiView);
-                    dehumiView.AddChidren(new Button
-                    {
-                        Width = Application.GetRealWidth(112),
-                        Gravity = Gravity.CenterHorizontal,
-                        Height = 1,
-                        BackgroundColor = CSS.CSS_Color.DividingLineColor,
-                    });
-                    IconButton dehumiIconButton = new IconButton("FunctionIcon/Acst/grey/ModeDeHumiIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeDeHumiIcon.png",
-                        Language.StringByID(StringId.Humidity), curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == AcstParent_Attr_ModeValueEnum.dry.ToString());
-                    dehumiIconButton.Click(() =>
-                    {
-                        btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeDeHumiIcon2.png";
-                        dialog.Close();
-                        new System.Threading.Thread(() =>
-                        {
-                            Dictionary<string, string> d = new Dictionary<string, string>();
-                            d.Add("mode", AcstParent_Attr_ModeValueEnum.dry.ToString());
-                            Control.Ins.SendWriteCommand(function, d);
-                        })
-                        { IsBackground = true }.Start();
-                    });
-                    dehumiView.AddChidren(dehumiIconButton);
-                    #endregion
-                }
 
                 if (function.GetAttribute(AcstParent_AttrEnum.mode.ToString()).value.Contains(AcstParent_Attr_ModeValueEnum.fan.ToString()))
                 {
@@ -823,6 +787,40 @@
                     #endregion
                 }
 
+                if (function.GetAttribute(AcstParent_AttrEnum.mode.ToString()).value.Contains(AcstParent_Attr_ModeValueEnum.dry.ToString()))
+                {
+                    #region 闄ゆ箍
+                    var dehumiView = new FrameLayout()
+                    {
+                        X = Application.GetRealWidth(2),
+                        Width = Application.GetRealWidth(144),
+                        Height = Application.GetRealHeight(44),
+                    };
+                    dialogContentView.AddChidren(dehumiView);
+                    dehumiView.AddChidren(new Button
+                    {
+                        Width = Application.GetRealWidth(112),
+                        Gravity = Gravity.CenterHorizontal,
+                        Height = 1,
+                        BackgroundColor = CSS.CSS_Color.DividingLineColor,
+                    });
+                    IconButton dehumiIconButton = new IconButton("FunctionIcon/Acst/grey/ModeDeHumiIcon.png", $"FunctionIcon/Acst/{imageFolder}/ModeDeHumiIcon.png",
+                        Language.StringByID(StringId.Dry), curColor, function.GetAttrState(AcstParent_AttrEnum.mode.ToString()) == AcstParent_Attr_ModeValueEnum.dry.ToString());
+                    dehumiIconButton.Click(() =>
+                    {
+                        btnModeControl.SelectedImagePath = $"FunctionIcon/Acst/{imageFolder}/ModeDeHumiIcon2.png";
+                        dialog.Close();
+                        new System.Threading.Thread(() =>
+                        {
+                            Dictionary<string, string> d = new Dictionary<string, string>();
+                            d.Add("mode", AcstParent_Attr_ModeValueEnum.dry.ToString());
+                            Control.Ins.SendWriteCommand(function, d);
+                        })
+                        { IsBackground = true }.Start();
+                    });
+                    dehumiView.AddChidren(dehumiIconButton);
+                    #endregion
+                }
                 if (function.GetAttribute(AcstParent_AttrEnum.mode.ToString()).value.Contains(AcstParent_Attr_ModeValueEnum.heat_humidity.ToString()))
                 {
 
@@ -861,7 +859,6 @@
 
                 if (function.GetAttribute(AcstParent_AttrEnum.mode.ToString()).value.Contains(AcstParent_Attr_ModeValueEnum.humidity.ToString()))
                 {
-
                     #region 鍔犳箍
                     var humiView = new FrameLayout()
                     {
@@ -943,10 +940,10 @@
 
             btnWorkSceneControl.MouseUpEventHandler = (sender2, e2) =>
             {
-                if (function.trait_on_off.state == "off")
-                {
-                    return;
-                }
+                //if (function.trait_on_off.state == "off")
+                //{
+                //    return;
+                //}
                 Dialog dialog = new Dialog();
 
                 var dialogView = new FrameLayout();
@@ -1166,10 +1163,32 @@
                 Text = text,
             };
             contentView.AddChidren(btnText);
+
+
+            if (btnValue.Text.Length > 7)
+            {
+                btnValue.TextSize = 16;
+            }
+            else if (btnValue.Text.Length > 9)
+            {
+                btnValue.TextSize = 12;
+            }
+
         }
 
         public void UpdateValue(string value)
         {
+            if (value.Contains("."))
+            {
+                value = value.Remove(value.IndexOf('.'), value.Length - value.IndexOf('.'));
+            }
+            if (btnValue.Text.Length > 8)
+            {
+                btnValue.TextSize = 16;
+            }else if (btnValue.Text.Length > 10)
+            {
+                btnValue.TextSize = 12;
+            }
             btnValue.Text = value + unitString;
         }
     }

--
Gitblit v1.8.0