From 3f6685c77beeb12baf840733fb890860f4c26e7c Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期四, 25 七月 2024 17:25:59 +0800
Subject: [PATCH] 2024年07月25日17:24:45

---
 HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/CacControlPage.cs |  163 +++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 125 insertions(+), 38 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/CacControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/CacControlPage.cs
index 7683c79..a46b9a4 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/CacControlPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/CacControlPage.cs
@@ -28,14 +28,27 @@
         /// </summary>
         Button btnTemp;
         Button btnTempUint;
+
+        /// <summary>
+        /// 瀹ゅ唴婀垮害鏄剧ず鎺т欢
+        /// </summary>
+        TextButton btnHumidityValues;
+        /// <summary>
+        /// 瀹ゅ唴娓╁害鏄剧ず鎺т欢
+        /// </summary>
+        TextButton btnTempValues;
         /// <summary>
         /// 瀹ゅ唴娓╁害鎸夐挳
         /// </summary>
-        Button btnIndoorTemp;
+        //Button btnIndoorTemp;
         /// <summary>
         /// 妯″紡鎸夐挳
         /// </summary>
         Button btnMode;
+        /// <summary>
+        /// 
+        /// </summary>
+        Button btnModeText;
         /// <summary>
         /// 椋庨�熸寜閽�
         /// </summary>
@@ -89,6 +102,7 @@
             this.RefreshNowDeviceStatuMemory(this.device);
             //鍒锋柊鐣岄潰鐘舵��
             this.RefreshFormStatu();
+            controlTime = DateTime.Now;
             //璇诲彇鐘舵��
             new System.Threading.Thread(() =>
             {
@@ -96,7 +110,7 @@
                 {
                     if (controlTime == DateTime.MinValue)
                     {
-
+                        
                     }
                     else if (controlTime.AddSeconds(2) < DateTime.Now)
                     {
@@ -114,18 +128,58 @@
         /// </summary>
         private void InitFrameWhiteContent1()
         {
-            Button btnJinmaoIcon = new Button()
+            var btnHumidityIcon = new Button()
             {
-                Gravity = Gravity.CenterHorizontal,
-                Y = Application.GetRealHeight(94),
-                Width = Application.GetRealWidth(164),
-                Height = Application.GetRealHeight(43),
-                UnSelectedImagePath = "FunctionIcon/CAC/JinMaoIcon.png"
+                X = Application.GetRealWidth(194),
+                Y = Application.GetRealHeight(101),
+                Width = Application.GetMinRealAverage(28),
+                Height = Application.GetMinRealAverage(28),
+                UnSelectedImagePath = "FunctionIcon/CAC/HvacCacHumidityIcon.png",
             };
-            FrameWhiteCentet1.AddChidren(btnJinmaoIcon);
+            FrameWhiteCentet1.AddChidren(btnHumidityIcon);
+            btnHumidityValues = new TextButton()
+            {
+                X = Application.GetRealWidth(222),
+                Y = Application.GetRealHeight(96),
+                Height = Application.GetRealHeight(33),
+                Width = Application.GetRealWidth(100),
+                TextColor = 0xFF161616,
+                TextSize = 24,
+                Text = device.GetAttrState(FunctionAttributeKey.RoomHumidity) + "%",
+                TextAlignment = TextAlignment.CenterLeft,
+            };
+            FrameWhiteCentet1.AddChidren(btnHumidityValues);
+
+            Button btnTempIcon = new Button()
+            {
+                X = Application.GetRealWidth(55),
+                Y = Application.GetRealHeight(101),
+                Width = Application.GetMinRealAverage(28),
+                Height = Application.GetMinRealAverage(28),
+                UnSelectedImagePath = "FunctionIcon/CAC/HvacCacTempIcon.png",
+            };
+            FrameWhiteCentet1.AddChidren(btnTempIcon);
+
+            btnTempValues = new TextButton()
+            {
+                X = Application.GetRealWidth(83),
+                Y = Application.GetRealHeight(96),
+                Height = Application.GetRealHeight(33),
+                Width = Application.GetRealWidth(100),
+                TextColor = 0xFF161616,
+                TextSize = 24,
+                Text = device.GetAttrState(FunctionAttributeKey.RoomTemp) + "掳C",
+                TextAlignment = TextAlignment.CenterLeft,
+            };
+            FrameWhiteCentet1.AddChidren(btnTempValues);
 
 
             temp = (int)Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", "."));
+            if (temp <= 0)
+            {
+                temp = 16;
+                device.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString());
+            }
             arcBar = new DiyArcSeekBar()
             {
                 Gravity = Gravity.CenterHorizontal,
@@ -135,12 +189,12 @@
                 OfflineProgressBarColor = CSS_Color.PromptingColor2,
                 ArcColor = CSS_Color.BackgroundColor,
 #if __IOS__
-                Y = Application.GetRealHeight(120 + 25),
+                Y = Application.GetRealHeight(130 + 25),
                 Width = Application.GetRealWidth(260 - 40),
                 Height = Application.GetRealWidth(260 - 40),
                 SeekBarPadding = Application.GetRealWidth(8),
 #else
-                Y = Application.GetRealHeight(120 + 40),
+                Y = Application.GetRealHeight(130 + 40),
                 Width = Application.GetRealWidth(260 - 40),
                 Height = Application.GetRealWidth(260 - 40),
                 SeekBarPadding = Application.GetRealWidth(7),
@@ -154,18 +208,18 @@
             arcBar.IsOffline = device.GetAttrState(FunctionAttributeKey.OnOff) == "off";
             arcBar.MinValue = device.GetAttribute(FunctionAttributeKey.SetTemp).min;
             arcBar.MaxValue = device.GetAttribute(FunctionAttributeKey.SetTemp).max;
-            arcBar.Progress = (int)Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", "."));
+            arcBar.Progress =temp;
 
             btnTemp = new Button()
             {
                 Gravity = Gravity.CenterHorizontal,
-                Y = Application.GetRealHeight(206),
+                Y = Application.GetRealHeight(226),
                 Width = Application.GetRealWidth(71),
                 Height = Application.GetRealWidth(60),
                 TextColor = CSS_Color.FirstLevelTitleColor,
                 TextSize = 50,
                 IsBold = true,
-                Text = Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", ".")).ToString(),
+                Text = Convert.ToDouble(temp).ToString(),
                 TextAlignment = TextAlignment.Center,
             };
             FrameWhiteCentet1.AddChidren(btnTemp);
@@ -184,17 +238,17 @@
             };
             FrameWhiteCentet1.AddChidren(btnTempUint);
 
-            btnIndoorTemp = new Button()
-            {
-                Gravity = Gravity.CenterHorizontal,
-                Y = btnTemp.Bottom,
-                Width = Application.GetRealWidth(120),
-                Height = Application.GetRealHeight(20),
-                Text = Language.StringByID(StringId.IndoorTemp) + "20掳C/" + Language.StringByID(StringId.Humidity) +"45%",
-                TextColor = CSS_Color.PromptingColor1,
-                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-            };
-            FrameWhiteCentet1.AddChidren(btnIndoorTemp);
+            //btnIndoorTemp = new Button()
+            //{
+            //    Gravity = Gravity.CenterHorizontal,
+            //    Y = btnTemp.Bottom,
+            //    Width = Application.GetRealWidth(120),
+            //    Height = Application.GetRealHeight(20),
+            //    Text = Language.StringByID(StringId.IndoorTemp) + "20掳C/" + Language.StringByID(StringId.Humidity) +"45%",
+            //    TextColor = CSS_Color.PromptingColor1,
+            //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+            //};
+            //FrameWhiteCentet1.AddChidren(btnIndoorTemp);
 
             btnMinus = new Button()
             {
@@ -226,16 +280,16 @@
             };
             FrameWhiteCentet1.AddChidren(btnMode);
 
-            Button btnModeText = new Button()
+            btnModeText = new Button()
             {
                 X = Application.GetRealWidth(30),
-                Y = btnMode.Bottom,
+                Y = btnMode.Bottom + Application.GetRealHeight(4),
                 Width = Application.GetRealWidth(90),
                 Height = Application.GetRealHeight(20),
                 TextAlignment = TextAlignment.Center,
                 TextSize = 12,
                 TextColor = CSS_Color.TextualColor,
-                TextID = StringId.Mode
+                Text = acFunction.GetModeAttrText(device.GetAttrState(FunctionAttributeKey.Mode))
             };
             FrameWhiteCentet1.AddChidren(btnModeText);
 
@@ -251,7 +305,7 @@
 
             Button btnDataText = new Button()
             {
-                X = Application.GetRealWidth(215),
+                X = Application.GetRealWidth(212),
                 Y = btnWindSpeed.Bottom,
                 Width = Application.GetRealWidth(90),
                 Height = Application.GetRealHeight(20),
@@ -296,10 +350,10 @@
             modeChangeView = new FrameLayout()
             {
                 X = Application.GetRealWidth(30),
-                Y = Application.GetRealHeight(128),
+                Y = Application.GetRealHeight(128 + 135),
                 Width = Application.GetRealWidth(160),
-                Height = Application.GetRealHeight(287),
-                BackgroundImagePath = "FunctionIcon/AC/DivBg1.png",
+                Height = Application.GetRealHeight(152),
+                BackgroundImagePath = "Public/dialogBg2.png",
             };
             dialogView.AddChidren(modeChangeView);
 
@@ -534,14 +588,42 @@
         /// </summary>
         void LoadEvent_AcStatesChange()
         {
-            btnMode.MouseUpEventHandler = (sender, e) =>
+
+            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
             {
                 if (device.trait_on_off.curValue.ToString() == "off")
                 {
                     return;
                 }
-                LoadDiv_ChangeModeView();
+                var modeValueList = device.GetAttribute(FunctionAttributeKey.Mode).value;
+                if (modeValueList.Count == 0)
+                {
+                    return;
+                }
+
+                var curMode = device.GetAttrState(FunctionAttributeKey.Mode);
+                var curModeIndex = device.GetAttribute(FunctionAttributeKey.Mode).value.IndexOf(curMode);
+                if (++curModeIndex >= modeValueList.Count)
+                {
+                    curModeIndex = 0;
+                }
+                var setMode = device.GetAttribute(FunctionAttributeKey.Mode).value[curModeIndex];
+
+                device.SetAttrState(FunctionAttributeKey.Mode, setMode);
+                btnModeText.Text = acFunction.GetModeAttrText(setMode);
+                btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(setMode);
+                Dictionary<string, string> d = new Dictionary<string, string>();
+                d.Add(FunctionAttributeKey.Mode, setMode);
+                Control.Ins.SendWriteCommand(device, d);
+
+                //LoadDiv_ChangeModeView();
             };
+
+            btnMode.MouseUpEventHandler = eventHandler;
+            btnModeText.MouseUpEventHandler = eventHandler;
+
+
+
             btnWindSpeed.MouseUpEventHandler = (sender, e) =>
             {
                 var page = new CacHistoryChoosePage(device);
@@ -599,11 +681,16 @@
                 }
                 else
                 {
-                    btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp).Replace(",", "."))) + "掳C"
-                                        + Language.StringByID(StringId.Humidity) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState("room_humidity").Replace(", ", "."))) + "%";
-                    btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode));
-                    temp = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", ".")));
+                    //btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp).Replace(",", "."))) + "掳C"
+                    //                    + Language.StringByID(StringId.Humidity) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState("room_humidity").Replace(", ", "."))) + "%";
+                    btnTempValues.Text = Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp).Replace(",", ".")) + "掳C";
+                    btnHumidityValues.Text = Convert.ToDouble(device.GetAttrState("room_humidity").Replace(", ", ".")) + "%";
 
+                    btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode));
+                    btnModeText.Text = acFunction.GetModeAttrText(device.GetAttrState(FunctionAttributeKey.Mode));
+
+                    temp = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", ".")));
+                  
 
                     arcBar.Progress = temp;
                     btnTemp.Text = temp.ToString();

--
Gitblit v1.8.0