wxr
2020-12-21 f25c6122eb7e26be5e7f036cf29b9019c4953be2
HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -78,10 +78,6 @@
                    }
                    break;
            }
            #region  保存
            ///保存View
@@ -133,12 +129,44 @@
        }
        /// <summary>
        /// 移除控件
        /// 开关功能展开界面
        /// </summary>
        /// <param name="frame"></param>
        private void RemView(FrameLayout frame)
        /// <param name="device"></param>
        /// <param name="button"></param>
        /// <param name="len"></param>
        public void SwitchViewMethod(FrameLayout frame, Entity.Function device, Button button, int len)
        {
            frame.RemoveFromParent();
            LogicView.SwitchView switchView = new LogicView.SwitchView();
            switchView.FLayoutView(frame, len, button.Text, (strValue) =>
            {
                int id = 0;
                switch (strValue)
                {
                    case "on":
                        {
                            id = StringId.onLogic;
                        }
                        break;
                    case "off":
                        {
                            id = StringId.offLogic;
                        }
                        break;
                }
                button.TextID = id;
                keyVlaue = "on_off";
                Dictionary<string, string> dic = new Dictionary<string, string>();
                LogicMethod.dictionary(dic, "key", "on_off");
                LogicMethod.dictionary(dic, "comparator", "=");
                LogicMethod.dictionary(dic, "data_type", "string");
                LogicMethod.dictionary(dic, "value", strValue);
                AddDictionaryData(dicSateteList, keyVlaue, dic);
                selectedState = device.functionType + "_" + strValue;
            });
        }
        /// <summary>
        /// 显示编辑之前的设备状态
@@ -257,49 +285,12 @@
        }
        /// <summary>
        /// 开关功能展开界面
        /// 移除控件
        /// </summary>
        /// <param name="frame"></param>
        /// <param name="device"></param>
        /// <param name="button"></param>
        /// <param name="len"></param>
        public void SwitchViewMethod(FrameLayout frame, Entity.Function device, Button button, int len)
        private void RemView(FrameLayout frame)
        {
            LogicView.SwitchView switchView = new LogicView.SwitchView();
            switchView.FLayoutView(frame, len);
            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";
            switchView.btnOn.MouseUpEventHandler += (sender2, e2) =>
            {
                LogicMethod.dictionary(dic, "value", "on");
                button.TextID = StringId.onLogic;
                selectedState = device.functionType + "_on";
                AddDictionaryData(dicSateteList, keyVlaue, dic);
                RemView(frame);
            };
            switchView.btnOff.MouseUpEventHandler += (sender3, e3) =>
            {
                LogicMethod.dictionary(dic, "value", "off");
                button.TextID = StringId.offLogic;
                selectedState = device.functionType + "_off";
                AddDictionaryData(dicSateteList, keyVlaue, dic);
                RemView(frame);
            };
            if (button.Text != "")
            {
                if (button.Text == switchView.btnOn.Text)
                {
                    switchView.btnOn.TextColor = CSS.CSS_Color.textConfirmColor;
                }
                else if (button.Text == switchView.btnOff.Text)
                {
                    switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor;
                }
            }
            frame.RemoveFromParent();
        }
    }
}