wjc
2023-07-18 edfb48fa10b0518311ee46bef4aded0859069d16
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 @@
        }
    }
}