From 9508510f0b27da3278fa1161eb2ba3dd1e3e2030 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期三, 26 七月 2023 13:14:00 +0800
Subject: [PATCH] 2023年07月26日13:12:21

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs |  124 +++++++++++++++++++++++++++++++++++-----
 1 files changed, 107 insertions(+), 17 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
index e828e1a..26c55dc 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -56,6 +56,88 @@
             #region  缂栬緫璁惧鐘舵��
             switch (device.spk)
             {
+                //缇ゆ帶
+                case SPK.GroupControl:
+                    int height = Application.GetRealHeight(50);
+                    int attributesNameId=0;
+                    int count = 0;
+                    foreach (var attr in (device as GroupControl).attributes)
+                    {
+                        if (attr.key == FunctionAttributeKey.OnOff ||
+                            attr.key == FunctionAttributeKey.Brightness ||
+                            attr.key == FunctionAttributeKey.CCT ||
+                            attr.key == FunctionAttributeKey.RGB ||
+                            attr.key == FunctionAttributeKey.Colorful)
+                        {
+                            LogicView.FunTypeView view = new LogicView.FunTypeView();
+                            view.btnState.Name = "缇ゆ帶";
+                            view.frameLayout.Y = count * height;
+                            fLayout.AddChidren(view.FLayoutView());
+                            count++;
+                            switch (attr.key)
+                            {
+                                case FunctionAttributeKey.OnOff:
+                                    attributesNameId = StringId.switchLogic;
+                                    ///寮�鍏崇偣鍑讳簨浠�
+                                    view.btnClick.MouseUpEventHandler += (sender, e) =>
+                                    {
+                                        SwitchViewMethod(device, view.btnState, 2);
+                                    };
+                                    break;
+                                case FunctionAttributeKey.Brightness:
+                                    attributesNameId = StringId.brightnesLogic;
+                                    view.btnState.Text = "5%";//浜у搧缁忕悊鏅撹緣瑕佹眰鏀圭殑 2021-11-06
+                                    ///浜害鐐瑰嚮浜嬩欢
+                                    view.btnClick.MouseUpEventHandler += (sender, e) =>
+                                    {
+                                        BrightnessMethod(device, view.btnState, view.btnText.Text);
+
+                                    };
+                                    break;
+                                case FunctionAttributeKey.CCT:
+                                    attributesNameId = StringId.ColorTemperature;
+                                    ///鑹叉俯鐐瑰嚮浜嬩欢
+                                    view.btnClick.MouseUpEventHandler += (sender, e) =>
+                                    {
+                                        ColorTemperatureMethod(device, view.btnState, view.btnText.Text);
+
+                                    };
+                                    break;
+                                case FunctionAttributeKey.RGB:
+                                    attributesNameId = StringId.rgbsepan;
+                                    view.btnState.Tag = "";
+                                    view.btnState.Width = Application.GetRealWidth(16);
+                                    view.btnState.Height = Application.GetRealWidth(16);
+                                    view.btnState.Radius = (uint)Application.GetRealWidth(8);
+                                    view.btnState.X = Application.GetRealWidth(375 - 48 - 16);
+                                    ///RGB鑹茬洏鐐瑰嚮浜嬩欢
+                                    view.btnClick.MouseUpEventHandler += (sender, e) =>
+                                    {
+                                        RgbColorDiskMethod(device, view.btnState, view.btnText.Text);
+                                    };
+                                    break;
+                                case FunctionAttributeKey.Colorful:
+                                    attributesNameId = StringId.ColorfulFunction;
+                                    view.btnState.Name = "colorful";
+                                    ///寮�鍏崇偣鍑讳簨浠�
+                                    view.btnClick.MouseUpEventHandler += (sender, e) =>
+                                    {
+                                        SwitchViewMethod(device, view.btnState, 2);
+                                    };
+                                    break;
+                            }
+                            view.btnText.TextID = attributesNameId;
+                            if (edit)
+                            {
+                                //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
+                                GetEditDeviceState(device, index, view.btnState, null, null, null, attr.key);
+                            }
+                        }
+                    }
+
+                    //璁惧寤舵椂iewv
+                    DelayView(fLayout, height* count);
+                    break;
                 //鎻掑骇(鏈塙SB)
                 case SPK.PanelSocket:
                     {
@@ -168,8 +250,7 @@
                         ///RGB鑹茬洏
                         LogicView.FunTypeView rgbView = new LogicView.FunTypeView();
                         rgbView.frameLayout.Y = brightnessView.frameLayout.Bottom;
-                        //rgbView.btnText.TextID = StringId.brightnesLogic;
-                        rgbView.btnText.Text= "RGB鑹茬洏";
+                        rgbView.btnText.TextID = StringId.rgbsepan;
                         rgbView.btnState.Tag = "";
                         rgbView.btnState.Width = Application.GetRealWidth(16);
                         rgbView.btnState.Height = Application.GetRealWidth(16);
@@ -388,12 +469,7 @@
                         };
                         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;
-                        if (string.IsNullOrEmpty(unit))
-                        {
-                            //璋冭瘯杞欢鏈夌┖鑳戒笂浼犱负绌�
-                            unit = "鈩�";
-                        }
+                        string unit = InpOrOutLogicMethod.Current.GetTemperatureUnit(device);
                         ///娓╁害鐐瑰嚮浜嬩欢
                         temperatureView.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
@@ -410,7 +486,7 @@
                                 string set_temp_value = stateStr.Replace(unit, "");
                                 //鏁版嵁灏佽
                                 AddDictionary(keyVlaue, set_temp_value);
-                            }, min,max, unit);
+                            }, min, max, unit);
 
                         };
                         ///妯″紡鐐瑰嚮浜嬩欢
@@ -499,11 +575,7 @@
                         {
                             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;
-                            if (string.IsNullOrEmpty(unit)) {
-                                //璋冭瘯杞欢鏈夌┖鑳戒笂浼犱负绌�
-                                unit = "鈩�";
-                            }
+                            string unit = InpOrOutLogicMethod.Current.GetTemperatureUnit(device);
                             string tempValue = temperatureView.btnState.Text;
                             LogicView.TemperatureView tempView = new LogicView.TemperatureView();
                             tempView.FLayoutView(this, tempValue, (stateStr) =>
@@ -815,6 +887,11 @@
                                 }
                             }
                             break;
+                        case SPK.GroupControl:
+                            {
+                                outputDevice.target_type = "5";
+                            }
+                            break;
 
                     }
                     outputDevice.status.AddRange(dicSateteList);
@@ -929,6 +1006,15 @@
                             }
                         }
                         break;
+                    case SPK.GroupControl:
+                        {
+                            if (button.Name == "colorful")
+                            {
+                                keyVlaue = "colorful";
+                            }
+
+                        }
+                        break;
                 }
                 //鏁版嵁灏佽
                 AddDictionary(keyVlaue, strValue);
@@ -960,6 +1046,7 @@
                     case SPK.LightRGB:
                     case SPK.LightRGBW:
                     case SPK.LightCCT:
+                    case SPK.GroupControl:
                         {
                             keyVlaue = "brightness";
                         }
@@ -1004,6 +1091,7 @@
                 switch (device.spk)
                 {
                     case SPK.LightCCT:
+                    case SPK.GroupControl:
                         {
                             keyVlaue = "cct";
                         }
@@ -1037,6 +1125,7 @@
                 switch (device.spk)
                 {
                     case SPK.LightRGB:
+                    case SPK.GroupControl:
                         {
                             keyVlaue = "rgb";
                         }
@@ -1053,7 +1142,7 @@
 
         }
 
-     
+
 
 
         /// <summary>
@@ -1065,7 +1154,8 @@
         /// <param name="button2">鏄剧ずBtn</param>
         /// <param name="button3">鏄剧ずBtn</param>
         /// <param name="button4">鏄剧ずBtn</param>
-        private void GetEditDeviceState(Entity.Function device, int index, Button button1, Button button2, Button button3, Button button4)
+        /// <param name="attribute">灞炴�ey</param>
+        private void GetEditDeviceState(Entity.Function device, int index, Button button1, Button button2, Button button3, Button button4, string attribute="")
         {
             Output outputs = Logic.currlogic.output[index];
             var dicList = outputs.status;
@@ -1082,7 +1172,7 @@
                 this.btnDelay.Text = outputs.delay + "s";
                 this.strdelay = outputs.delay;
             }
-            InpOrOutLogicMethod.Current.EditDeviceState(device, dicList, button1, button2, button3, button4);
+            InpOrOutLogicMethod.Current.EditDeviceState(device, dicList, button1, button2, button3, button4, attribute);
         }
         /// <summary>
         /// 娣诲姞閫変腑鏁版嵁

--
Gitblit v1.8.0