From edfb48fa10b0518311ee46bef4aded0859069d16 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 18 七月 2023 17:51:52 +0800
Subject: [PATCH] 2023年07月18日17:50:46

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs |  115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 111 insertions(+), 4 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
index 2104754..e828e1a 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -2,6 +2,7 @@
 using Shared;
 using System.Collections.Generic;
 using HDL_ON.Entity;
+using HDL_ON.UI.CSS;
 
 namespace HDL_ON.UI.UI2.Intelligence.Automation
 {
@@ -113,8 +114,8 @@
                     break;
                 //鐏厜寮�鍏� 浜害
                 case SPK.LightDimming:
-                case SPK.LightRGB:
-                case SPK.LightRGBW:
+                //case SPK.LightRGB:
+                //case SPK.LightRGBW:
                     {
                         #region 鐣岄潰
                         ///寮�鍏�
@@ -146,6 +147,60 @@
                         {
                             //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
                             GetEditDeviceState(device, index, lightSwitchView.btnState, brightnessView.btnState, null, null);
+                        }
+                        #endregion
+                    }
+                    break;
+                case SPK.LightRGB:
+                case SPK.LightRGBW:
+                    {
+                        #region 鐣岄潰
+                        ///寮�鍏�
+                        LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView();
+                        lightSwitchView.btnText.TextID = StringId.switchLogic;
+                        fLayout.AddChidren(lightSwitchView.FLayoutView());
+                        ///浜害
+                        LogicView.FunTypeView brightnessView = new LogicView.FunTypeView();
+                        brightnessView.frameLayout.Y = lightSwitchView.frameLayout.Bottom;
+                        brightnessView.btnText.TextID = StringId.brightnesLogic;
+                        fLayout.AddChidren(brightnessView.FLayoutView());
+                        brightnessView.btnState.Text = "5%";//浜у搧缁忕悊鏅撹緣瑕佹眰鏀圭殑 2021-11-06
+                        ///RGB鑹茬洏
+                        LogicView.FunTypeView rgbView = new LogicView.FunTypeView();
+                        rgbView.frameLayout.Y = brightnessView.frameLayout.Bottom;
+                        //rgbView.btnText.TextID = StringId.brightnesLogic;
+                        rgbView.btnText.Text= "RGB鑹茬洏";
+                        rgbView.btnState.Tag = "";
+                        rgbView.btnState.Width = Application.GetRealWidth(16);
+                        rgbView.btnState.Height = Application.GetRealWidth(16);
+                        rgbView.btnState.Radius = (uint)Application.GetRealWidth(8);
+                        rgbView.btnState.X = Application.GetRealWidth(375 - 48 - 16);
+                        fLayout.AddChidren(rgbView.FLayoutView());
+                        ///璁惧寤舵椂iewv
+                        DelayView(fLayout, rgbView.frameLayout.Bottom);
+                        #endregion
+                        #region 鐐瑰嚮浜嬩欢
+                        ///寮�鍏崇偣鍑讳簨浠�
+                        lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            SwitchViewMethod(device, lightSwitchView.btnState, 2);
+                        };
+                        ///浜害鐐瑰嚮浜嬩欢
+                        brightnessView.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            BrightnessMethod(device, brightnessView.btnState, brightnessView.btnText.Text);
+
+                        };
+                        ///RGB鑹茬洏鐐瑰嚮浜嬩欢
+                        rgbView.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            RgbColorDiskMethod(device, rgbView.btnState, rgbView.btnText.Text);
+
+                        };
+                        if (edit)
+                        {
+                            //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
+                            GetEditDeviceState(device, index, lightSwitchView.btnState, brightnessView.btnState, rgbView.btnState, null);
                         }
                         #endregion
                     }
@@ -333,7 +388,12 @@
                         };
                         int min = device.GetAttribute("set_temp") == null ? 16 : device.GetAttribute("set_temp").min;
                         int max = device.GetAttribute("set_temp") == null ? 32 : device.GetAttribute("set_temp").max;
-                        string unit = device.GetAttribute("temperature_type") == null ? "掳" : device.GetAttribute("temperature_type").state;
+                        string unit = device.GetAttribute("temperature_type") == null ? "鈩�" : device.GetAttribute("temperature_type").state;
+                        if (string.IsNullOrEmpty(unit))
+                        {
+                            //璋冭瘯杞欢鏈夌┖鑳戒笂浼犱负绌�
+                            unit = "鈩�";
+                        }
                         ///娓╁害鐐瑰嚮浜嬩欢
                         temperatureView.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
@@ -439,7 +499,11 @@
                         {
                             int min = device.GetAttribute("set_temp") == null ? 16 : device.GetAttribute("set_temp").min;
                             int max = device.GetAttribute("set_temp") == null ? 32 : device.GetAttribute("set_temp").max;
-                            string unit = device.GetAttribute("temperature_type") == null ? "掳" : device.GetAttribute("temperature_type").state;
+                            string unit = device.GetAttribute("temperature_type") == null ? "鈩�" : device.GetAttribute("temperature_type").state;
+                            if (string.IsNullOrEmpty(unit)) {
+                                //璋冭瘯杞欢鏈夌┖鑳戒笂浼犱负绌�
+                                unit = "鈩�";
+                            }
                             string tempValue = temperatureView.btnState.Text;
                             LogicView.TemperatureView tempView = new LogicView.TemperatureView();
                             tempView.FLayoutView(this, tempValue, (stateStr) =>
@@ -951,6 +1015,47 @@
             #endregion
 
         }
+
+        /// <summary>
+        /// RGB鑹茬洏涓撶敤
+        /// </summary>
+        /// <param name="device">璁惧</param>
+        /// <param name="button">鐘舵�佹帶浠�</param>
+        /// <param name="titleName">鏍囬</param>
+        private void RgbColorDiskMethod(Entity.Function device, Button button, string titleName)
+        {
+            LogicView.RGBColorView rgbColorView = new LogicView.RGBColorView();
+            rgbColorView.LoadRGBDialog(button.Tag.ToString(), (rgbValueStr) =>
+            {
+                button.BackgroundColor = rgbColorView.GetBackgroundColor(rgbValueStr);
+                //鐣岄潰鏄剧ず閫変腑鍊�
+                button.Tag = rgbValueStr;
+                //button.Text = rgbValueStr;
+                selectedState = device.spk + rgbValueStr.ToString();
+                //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�;
+                string keyVlaue = "";
+                switch (device.spk)
+                {
+                    case SPK.LightRGB:
+                        {
+                            keyVlaue = "rgb";
+                        }
+                        break;
+                    case SPK.LightRGBW:
+                        {
+                            keyVlaue = "rgbw";
+                        }
+                        break;
+                }
+                //鏁版嵁灏佽
+                AddDictionary(keyVlaue, rgbValueStr);
+            });
+
+        }
+
+     
+
+
         /// <summary>
         /// 鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
         /// </summary>
@@ -1054,5 +1159,7 @@
 
         }
 
+       
+
     }
 }

--
Gitblit v1.8.0