wjc
2022-06-30 56dfdc1bf7e7f2bb2456f29c3686dfa935a89e80
2022年06月30日13:59:08

更新自动化支持梦幻窗帘功能
4个文件已修改
179 ■■■■■ 已修改文件
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -1084,6 +1084,25 @@
                                        }
                                    }
                                    break;
                                case SPK.CurtainDream:
                                    {
                                        string percent = GetKeyValue("percent", dicList);
                                        string angle = GetKeyValue("angle", dicList);
                                        if (percent != "" && angle != "")
                                        {
                                            stateStr += Language.StringByID(StringId.onLogic) + percent + "%;";
                                            stateStr +=Language.StringByID(StringId.Angle)+angle + "°";
                                        }
                                        else if (percent != "")
                                        {
                                            stateStr = Language.StringByID(StringId.onLogic) + percent + "%";
                                        }
                                        else if (angle != "")
                                        {
                                            stateStr = Language.StringByID(StringId.onLogic) + Language.StringByID(StringId.Angle) + angle + "°";
                                        }
                                    }
                                    break;
                                case SPK.AcStandard:
                                case SPK.HvacAC:
                                    {
@@ -1591,6 +1610,39 @@
                        
                    }
                    break;
                case SPK.CurtainDream:
                    {
                        foreach (var dic in dicList)
                        {
                            string value = dic["value"];
                            switch (dic["key"])
                            {
                                case "percent":
                                    {
                                        if (button1 == null)
                                        {
                                            //怕调试软件乱上东西导致抛异常
                                            break;
                                        }
                                        button1.Text = value + "%";
                                    }
                                    break;
                                case "angle":
                                    {
                                        if (button2 == null)
                                        {
                                            //怕调试软件乱上东西导致抛异常
                                            break;
                                        }
                                        button2.Text = value + "°";
                                    }
                                    break;
                            }
                        }
                    }
                    break;
                case SPK.AcStandard:
                case SPK.HvacAC:
                    {
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -346,6 +346,7 @@
                case SPK.CurtainSwitch:
                case SPK.CurtainRoller:
                case SPK.CurtainTrietex:
                case SPK.CurtainDream:
                    {
                        strPath = "LogicIcon/curtainlogic.png";
                    }
@@ -432,7 +433,8 @@
            var curtainjosn = deviceList.Find((device) =>
            device.spk == SPK.CurtainSwitch
            || device.spk == SPK.CurtainTrietex
            || device.spk == SPK.CurtainRoller);
            || device.spk == SPK.CurtainRoller
            || device.spk == SPK.CurtainDream);
            if (curtainjosn != null)
            {
                deviceStrTypeList.Add(Language.StringByID(StringId.Curtain));
@@ -528,6 +530,7 @@
                functionTypeList.Add(SPK.CurtainSwitch);
                functionTypeList.Add(SPK.CurtainRoller);
                functionTypeList.Add(SPK.CurtainTrietex);
                functionTypeList.Add(SPK.CurtainDream);
            }
            ///空调类
            else if (deviceType == Language.StringByID(StringId.AC))
@@ -704,6 +707,7 @@
                        deviceTypeList.Add(SPK.AirSwitch);
                        deviceTypeList.Add(SPK.PanelSocket);
                        deviceTypeList.Add(SPK.ElectricSocket);
                        deviceTypeList.Add(SPK.CurtainDream);
                    }
                    break;
            }
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs
@@ -130,7 +130,7 @@
        /// <param name="titleName">标题名称</param>
        /// <param name="stateValue">之前状态值</param>
        /// <param name="action">返回回调</param>
        public void FLayoutView(FrameLayout frame, string titleName,string stateValue, Action<string> action)
        public void FLayoutView(FrameLayout frame, string titleName,string stateValue, Action<string,string> action)
        {
            FrameLayout fLayout = new FrameLayout
            {
@@ -147,14 +147,33 @@
            frameLayout.AddChidren(btn_add);
            frameLayout.AddChidren(btn_add_click);
            btnTitle.Text = titleName;
            //进来的状态
            if (stateValue.Contains("%"))
            {
                //百分比
            }
            else if (stateValue.Contains("°"))
            {
                //角度
                //角度取值范围
                seekBarVol.MinValue = 0;
                seekBarVol.MaxValue = 180;
                seekBarVol.ProgressBarUnitSring = "°";
            }
            else
            {
                //音量没有单位
                seekBarVol.MinValue = 0;
                seekBarVol.MaxValue = 100;
                seekBarVol.ProgressBarUnitSring = "";
            }
            //第一个变化记录选中值
            int brightnesValue = 0;
            if (stateValue != "")
            {
                try
                {
                    //进来的状态
                    brightnesValue = int.Parse(stateValue.Replace("%", ""));
                    brightnesValue = int.Parse(UnitDisposeSring(stateValue));
                    seekBarVol.Progress = brightnesValue;
                }
                catch { }
@@ -198,16 +217,63 @@
                //{
                //    return;
                //}
                action(brightnesValue.ToString());
                action(brightnesValue.ToString(), UnitSring(stateValue));
                //移除fLayout界面
                fLayout.RemoveFromParent();
            };
        }
        /// <summary>
        //进度值显示单位
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public string UnitSring(string str)
        {
            //进来的状态
            if (str.Contains("%"))
            {
                //百分比
                return "%";
            }
            else if (str.Contains("°"))
            {
                //角度
                return "°";
            }
            else {
                //没有单位
                return "";
            }
        }
        /// <summary>
        ///去单位
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public string UnitDisposeSring(string str)
        {
            //进来的状态
            if (str.Contains("%"))
            {
                //百分比
                return str.Replace("%", "");
            }
            else if (str.Contains("°"))
            {
                //角度
                return str.Replace("°", "");
            }
            else
            {
                //没有单位
                return str;
            }
        }
        ///// <summary>
        ///// View的方法
HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -186,6 +186,43 @@
                        #endregion
                    }
                    break;
                case SPK.CurtainDream:
                    {
                        #region 界面
                        ///百分比
                        LogicView.FunTypeView crtainPercentumView = new LogicView.FunTypeView();
                        crtainPercentumView.btnText.TextID = StringId.percentum;
                        fLayout.AddChidren(crtainPercentumView.FLayoutView());
                        crtainPercentumView.btnState.Text = "5%";//产品经理晓辉要求改的 2021-11-06
                        ///角度
                        LogicView.FunTypeView AngleView = new LogicView.FunTypeView();
                        AngleView.frameLayout.Y = crtainPercentumView.frameLayout.Bottom;
                        AngleView.btnText.TextID = StringId.Angle;
                        fLayout.AddChidren(AngleView.FLayoutView());
                        AngleView.btnState.Text = "10°";
                        ///设备延时iewv
                        DelayView(fLayout, AngleView.frameLayout.Bottom);
                        #endregion
                        #region 点击事件
                        ///百分比点击事件
                        crtainPercentumView.btnClick.MouseUpEventHandler += (sender, e) =>
                        {
                            BrightnessMethod(device, crtainPercentumView.btnState, crtainPercentumView.btnText.Text);
                        };
                        ///角度点击事件
                        AngleView.btnClick.MouseUpEventHandler += (sender, e) =>
                        {
                            BrightnessMethod(device, AngleView.btnState, AngleView.btnText.Text);
                        };
                        if (edit)
                        {
                            //显示编辑之前的设备状态
                            GetEditState(device, index, crtainPercentumView.btnState, AngleView.btnState, null, null);
                        }
                        #endregion
                    }
                    break;
                case SPK.AcStandard:
                case SPK.HvacAC:
                    {
@@ -647,10 +684,10 @@
            //之前的状态值
            string stateVlaue = button.Text;
            LogicView.BrightnessView brightness = new LogicView.BrightnessView();
            brightness.FLayoutView(this, titleName, stateVlaue, (brightnesValue) =>
            brightness.FLayoutView(this, titleName, stateVlaue, (brightnesValue, unitStr) =>
            {
                //界面显示选中值
                button.Text = brightnesValue + "%";
                button.Text = brightnesValue + unitStr;
                selectedState = device.spk + brightnesValue.ToString();
                //设备属性值,云雀上定义好的;
                string keyVlaue = "";
@@ -667,8 +704,14 @@
                        break;
                    case SPK.CurtainRoller:
                    case SPK.CurtainTrietex:
                    case SPK.CurtainDream:
                        {
                            keyVlaue = "percent";
                            if (unitStr == "°")
                            {
                                //角度
                                keyVlaue = "angle";
                            }
                        }
                        break;
                }