From 6fe1c5ebeb8312edc479a4576f05d80c5051a6c6 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 19 七月 2023 19:47:00 +0800
Subject: [PATCH] 炫彩功能优化

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs |  185 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 178 insertions(+), 7 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index eb3fb05..6da1d29 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -467,7 +467,13 @@
 
                                     }
                                     break;
-                                case SPK.sensorPirhold:
+                                case SPK.Ev_Ipcam:
+                                    if (inputCondition.identifier == "pir_event")
+                                    {
+                                        inputView.btnState.Text = Language.StringByID(StringId.On);
+                                    }
+                                    break;
+                                case SPK.SensorPirHold:
                                     {
                                         string value = this.GetKeyValue("people_status", dicList);
                                         if (string.IsNullOrEmpty(value))
@@ -989,6 +995,7 @@
                 switch (outputTarget.target_type)
                 {
                     case "1":
+                    case "5":
                         {
                             //鐢╯id鎵惧埌璁惧锛�
                             var device = LogicMethod.Current.GetDevice(outputTarget.sid);
@@ -1002,7 +1009,11 @@
                             //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
                             switch (device.spk)
                             {
-
+                               
+                                case SPK.CommonSeries:
+                                    targetView.btnIcon.UnSelectedImagePath = "FunctionIcon/Icon/groupControl.png";
+                                    stateStr = GetKeyValue("on_off", dicList) == "on" ? Language.StringByID(StringId.onLogic) : Language.StringByID(StringId.offLogic);
+                                    break;
                                 //鎻掑骇(鏈塙SB)
                                 case SPK.PanelSocket:
                                     {
@@ -1040,11 +1051,14 @@
                                         }
                                     }
                                     break;
+                               
+                              
                                 case SPK.LightRGB:
                                 case SPK.LightRGBW:
                                 case SPK.LightCCT:
                                 case SPK.LightDimming:
                                     {
+                                        
                                         string on_off = GetKeyValue("on_off", dicList);
                                         string brightness = GetKeyValue("brightness", dicList);
                                         if (on_off == "on" && brightness != "")
@@ -1071,9 +1085,82 @@
                                                 stateStr += "," +GetKeyValue("cct", dicList) + "k";
                                             }
                                         }
+                                        if (device.spk == SPK.LightRGB)
+                                        {
+                                            string rgb = GetKeyValue("rgb", dicList);
+                                            if (!string.IsNullOrEmpty(rgb) && rgb.Length > 6)
+                                            {
+                                                targetView.btnStateColor.Visible = true;
+                                                targetView.btnStateColor.BackgroundColor = new LogicView.RGBColorView().GetBackgroundColor(rgb);
+                                            }
+                                        }
+                                        if (device.spk == SPK.LightRGBW)
+                                        {
+                                            string rgb = GetKeyValue("rgbw", dicList);
+                                            if (!string.IsNullOrEmpty(rgb) && rgb.Length > 6)
+                                            {
+                                                targetView.btnStateColor.Visible = true;
+                                                targetView.btnStateColor.BackgroundColor = new LogicView.RGBColorView().GetBackgroundColor(rgb);
+                                            }
+                                        }
 
                                     }
                                     break;
+                                case SPK.GroupControl: //缇ゆ帶
+                                    {
+                                        targetView.btnIcon.UnSelectedImagePath = "FunctionIcon/Icon/groupControl.png";
+                                        string on_off = GetKeyValue("on_off", dicList);
+                                        string brightness = GetKeyValue("brightness", dicList);
+                                        string cct = GetKeyValue(FunctionAttributeKey.CCT, dicList);
+                                        string colorful = GetKeyValue(FunctionAttributeKey.Colorful, dicList);
+                                        if (on_off == "on" && brightness != "")
+                                        {
+                                            stateStr = Language.StringByID(StringId.onLogic) + brightness + "%";
+                                        }
+                                        else if (on_off == "on")
+                                        {
+                                            stateStr = Language.StringByID(StringId.onLogic);
+                                        }
+                                        else if (on_off == "off")
+                                        {
+                                            stateStr = Language.StringByID(StringId.offLogic);
+                                        }
+                                        else if (brightness != "")
+                                        {
+                                            stateStr = brightness + "%";
+                                        }
+                                        //鑹叉俯杩欎釜灞炴�ф墠鏈夋晥
+                                        if (!string.IsNullOrEmpty(cct))
+                                        {
+                                            stateStr += "," + Language.StringByID(StringId.ColorTemperature) + cct + "k";
+                                        }
+
+                                        if (!string.IsNullOrEmpty(colorful))
+                                        {
+                                            stateStr += "," + Language.StringByID(StringId.ColorfulFunction);
+                                            if (colorful == "on")
+                                            {
+                                                stateStr += Language.StringByID(StringId.onLogic);
+                                            }
+                                            else if (colorful == "off")
+                                            {
+                                                stateStr += Language.StringByID(StringId.offLogic);
+                                            }
+
+                                            break;
+                                        }
+
+                                        string rgb = GetKeyValue("rgb", dicList);
+                                        if (!string.IsNullOrEmpty(rgb) && rgb.Length > 6)
+                                        {
+                                            targetView.btnStateColor.Visible = true;
+                                            targetView.btnStateColor.BackgroundColor = new LogicView.RGBColorView().GetBackgroundColor(rgb);
+                                        }
+
+
+                                    }
+                                    break;
+
                                 case SPK.CurtainSwitch:
                                     {
                                         foreach (var dic in dicList)
@@ -1170,8 +1257,12 @@
 
                                         if (set_temp != "")
                                         {
-
-                                            stateStr += set_temp + "鈩�,";
+                                            string unit = device.GetAttribute("temperature_type") == null ? "鈩�" : device.GetAttribute("temperature_type").state;
+                                            if (string.IsNullOrEmpty(unit))
+                                            {
+                                                unit = "鈩�";
+                                            }
+                                            stateStr += set_temp + unit + ",";
                                         }
 
                                         if (mode != "")
@@ -1268,8 +1359,12 @@
                                         }
                                         if (set_temp != "")
                                         {
-
-                                            stateStr += set_temp + "鈩�,";
+                                            string unit = device.GetAttribute("temperature_type") == null ? "鈩�" : device.GetAttribute("temperature_type").state;
+                                            if (string.IsNullOrEmpty(unit))
+                                            {
+                                                unit = "鈩�";
+                                            }
+                                            stateStr += set_temp + unit + ",";
                                         }
                                         if (mode != "")
                                         {
@@ -1614,6 +1709,82 @@
                                         button3.Text = value + "k";
                                     }
                                     break;
+                                case "rgb":
+                                case "rgbw":
+                                    {
+                                        if (button3 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
+                                        if (!string.IsNullOrEmpty(value) && value.Length > 6)
+                                        {
+                                            button3.BackgroundColor = new LogicView.RGBColorView().GetBackgroundColor(value);
+                                            button3.Tag = value;
+                                        }
+                                    }
+                                    break;
+
+                            }
+
+                        }
+                    }
+                    break;
+                case SPK.GroupControl://缇ゆ帶
+                    {
+                        foreach (var dic in dicList)
+                        {
+                            string value = dic["value"];
+                            switch (dic["key"])
+                            {
+                                case "on_off":
+                                case "colorful":
+                                    {
+                                        if (value == "on")
+                                        {
+                                            button1.Text = Language.StringByID(StringId.onLogic);
+                                        }
+                                        else
+                                        {
+                                            button1.Text = Language.StringByID(StringId.offLogic);
+                                        }
+                                    }
+                                    break;
+                                case "brightness":
+                                    {
+                                        if (button1 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
+                                        button1.Text = value + "%";
+                                    }
+                                    break;
+                                case "cct":
+                                    {
+                                        if (button1 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
+                                        button1.Text = value + "k";
+                                    }
+                                    break;
+                                case "rgb":
+                                    {
+                                        if (button1 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
+                                        if (!string.IsNullOrEmpty(value) && value.Length > 6)
+                                        {
+                                            button1.BackgroundColor = new LogicView.RGBColorView().GetBackgroundColor(value);
+                                            button1.Tag = value;
+                                        }
+                                    }
+                                    break;
+
                             }
 
                         }
@@ -2074,7 +2245,7 @@
                         }
                     }
                     break;
-                case SPK.sensorPirhold:
+                case SPK.SensorPirHold:
                     {
                         foreach (var dic in dicList)
                         {

--
Gitblit v1.8.0