hxb
2020-12-17 5eeafe3af80bfd88306bd8ad9e76c8f4b51ca35f
HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -46,12 +46,12 @@
                case FunctionType.Dimmer:
                case FunctionType.RGB:
                case FunctionType.RGBW:
                case FunctionType.CCT:
                case FunctionType.ColorTemperature:
                case FunctionType.Relay:
                //窗帘
                case FunctionType.Curtain:
                case FunctionType.RollerCurtain:
                case FunctionType.TrietexCurtain:
                case FunctionType.RollingShutter:
                case FunctionType.MotorCurtain:
                //空调
                case FunctionType.AC:
                //地热
@@ -72,16 +72,16 @@
                        };
                        if (edit)
                        {
                            GetEditState(device, edit, index, lightSwitchView.btnState, null, null, null);
                            GetEditState(device, index, lightSwitchView.btnState, null, null, null);
                        }
                    }
                    break;
            }
            #region  保存
            ///保存View
@@ -144,28 +144,34 @@
        /// 显示编辑之前的设备状态
        /// </summary>
        /// <param name="device">编辑设备</param>
        /// <param name="edit">编辑状态</param>
        /// <param name="index">编辑数据的索引</param>
        /// <param name="button1">显示Btn</param>
        /// <param name="button2">显示Btn</param>
        /// <param name="button3">显示Btn</param>
        /// <param name="button4">显示Btn</param>
        private void GetEditState(Entity.Function device, bool edit, int index, Button button1, Button button2, Button button3, Button button4)
        private void GetEditState(Entity.Function device , int index, Button button1, Button button2, Button button3, Button button4)
        {
            Input inputs = Logic.currlogic.input[index];
            var dicList = inputs.condition as List<Dictionary<string, string>>;
            //清除之前旧数据
            dicSateteList.Clear();
            if (dicList.Count != 0)
            {
                //有数据重新赋值
                dicSateteList = dicList;
            }
            switch (device.functionType)
            {
                //开关灯光 light.Switch
                case FunctionType.Dimmer:
                case FunctionType.RGB:
                case FunctionType.RGBW:
                case FunctionType.CCT:
                case FunctionType.ColorTemperature:
                case FunctionType.Relay:
                //窗帘
                case FunctionType.Curtain:
                case FunctionType.RollerCurtain:
                case FunctionType.TrietexCurtain:
                case FunctionType.RollingShutter:
                case FunctionType.MotorCurtain:
                //空调
                case FunctionType.AC:
                //地热
@@ -262,67 +268,36 @@
            LogicView.SwitchView switchView = new LogicView.SwitchView();
            switchView.FLayoutView(frame, len);
            Button btnOn = new Button
            {
                TextAlignment = TextAlignment.Center,
                TextSize = LogicView.TextSize.text16,
                TextColor = CSS.CSS_Color.textCancelColor,
                TextID = StringId.onLogic,
                Height = Application.GetRealHeight(44),
                Width = Application.GetRealWidth(343),
            };
            switchView.frameLayout.AddChidren(btnOn);
            Button btnLine = new Button
            {
                Height = 1,
                BackgroundColor = CSS.CSS_Color.viewLine,
                Y = btnOn.Bottom,
            };
            switchView.frameLayout.AddChidren(btnLine);
            Button btnOff = new Button
            {
                Y = btnLine.Bottom,
                TextAlignment = TextAlignment.Center,
                TextSize = LogicView.TextSize.text16,
                TextColor = CSS.CSS_Color.textCancelColor,
                TextID = StringId.offLogic,
                Height = Application.GetRealHeight(44),
                Width = Application.GetRealWidth(343),
            };
            switchView.frameLayout.AddChidren(btnOff);
            Dictionary<string, string> dic = new Dictionary<string, string>();
            LogicMethod.dictionary(dic, "key", "on_off");
            LogicMethod.dictionary(dic, "comparator", "=");
            LogicMethod.dictionary(dic, "data_type", "string");
            keyVlaue = "on_off";
            btnOn.MouseUpEventHandler += (sender2, e2) =>
            switchView.btnOn.MouseUpEventHandler += (sender2, e2) =>
            {
                LogicMethod.dictionary(dic, "value", "on");
                RemView(frame);
                button.TextID = StringId.onLogic;
                selectedState = device.functionType + "_on";
                AddDictionaryData(dicSateteList, keyVlaue, dic);
                RemView(frame);
            };
            btnOff.MouseUpEventHandler += (sender3, e3) =>
            switchView.btnOff.MouseUpEventHandler += (sender3, e3) =>
            {
                LogicMethod.dictionary(dic, "value", "off");
                RemView(frame);
                button.TextID = StringId.offLogic;
                selectedState = device.functionType + "_off";
                AddDictionaryData(dicSateteList, keyVlaue, dic);
                RemView(frame);
            };
            if (button.Text != "")
            {
                if (button.Text == btnOn.Text)
                if (button.Text == switchView.btnOn.Text)
                {
                    btnOn.TextColor = CSS.CSS_Color.textConfirmColor;
                    switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor;
                }
                else
                else if (button.Text == switchView.btnOff.Text)
                {
                    btnOff.TextColor = CSS.CSS_Color.textConfirmColor;
                    switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor;
                }
            }
        }