wxr
2022-06-27 1f5d37fbca31293eff043f4a051be6f6876cea09
HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -61,6 +61,7 @@
                //空调
                case SPK.AcStandard:
                case SPK.HvacAC:
                case SPK.HvacCac://毛细空调
                //地热
                case SPK.FloorHeatStandard:
                case SPK.HvacFloorHeat:
@@ -78,6 +79,22 @@
                        view.btnClick.MouseUpEventHandler += (sender, e) =>
                        {
                            DeviceView(device, view.btnState, StringId.onLogic, StringId.offLogic);
                        };
                        if (edit)
                        {
                            GetEditState(device, index, view.btnState, null, null, null);
                        }
                    }
                    break;
                //紧急呼叫
                case SPK.SensorHelp:
                    {
                        LogicView.FunTypeView view = new LogicView.FunTypeView();
                        view.btnText.TextID = StringId.qiujiuandzhengchang;
                        fLayout.AddChidren(view.FLayoutView());
                        view.btnClick.MouseUpEventHandler += (sender, e) =>
                        {
                            DeviceView(device, view.btnState, StringId.qiujiu, StringId.zhengchang);
                        };
                        if (edit)
                        {
@@ -360,6 +377,7 @@
                //tvoc
                case SPK.SensorTVOC:
                    {
                        ///tvoc
                        LogicView.FunTypeView tvocView = new LogicView.FunTypeView();
                        tvocView.btnText.TextID = StringId.tvoc;
@@ -386,6 +404,23 @@
                            PmCo2TvocAction(this, device, "hcho", StringId.Formaldehyde, index, edit);
                        };
                    }
                    break;
                //门锁
                case SPK.DoorLock:
                    {
                        LogicView.FunTypeView view = new LogicView.FunTypeView();
                        view.btnText.TextID = StringId.shifoukaisuoshi;
                        fLayout.AddChidren(view.FLayoutView());
                        view.btnClick.MouseUpEventHandler += (sender, e) =>
                        {
                            DeviceView(device, view.btnState, StringId.shi, StringId.offLogic,1);
                        };
                        if (edit)
                        {
                            GetEditState(device, index, view.btnState, null, null, null);
                        }
                    }
                    break;
            }
@@ -465,12 +500,13 @@
        /// <param name="button">选中状态显示文本Btn控件</param>
        /// <param name="btnText1">属性状态值文本1</param>
        /// <param name="btnText2">属性状态值文本2</param>
        private void DeviceView(Entity.Function device, Button button, int btnText1, int btnText2)
        /// <param name="viewCount">view数量</param>
        private void DeviceView(Entity.Function device, Button button, int btnText1, int btnText2,int viewCount=2)
        {
            FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence };
            this.AddChidren(frame);
            LogicView.SwitchView switchView = new LogicView.SwitchView();
            switchView.FLayoutView(frame, btnText1, btnText2, button.Text, (intValue) =>
            switchView.FLayoutView(frame, btnText1, btnText2, button.Text, viewCount,(intValue) =>
            {
                //设备属性值,云雀上定义好的;
                string keyVlaue = "on_off";
@@ -481,6 +517,7 @@
                    case SPK.SensorGas:
                    case SPK.SensorWater:
                    case SPK.SensorSmoke:
                    case SPK.SensorHelp:
                        {
                            keyVlaue = "status";
                            if (!Is_SpkAttribute(keyVlaue)) {
@@ -520,6 +557,11 @@
                            {
                                keyVlaue = "megahealth_state";
                            }
                        }
                        break;
                    case SPK.DoorLock:
                        {
                            keyVlaue = "door_status";
                        }
                        break;
@@ -565,6 +607,7 @@
                            }
                        }
                        break;
                    case StringId.shi:
                    case StringId.kaiqi:
                        {
                            value = "open";
@@ -589,6 +632,8 @@
                        {
                            value = "fall";
                        }; break;
                }
                //显示文本
                button.TextID = intValue;
@@ -665,8 +710,10 @@
        /// <param name="stateValue">编辑之前的状态值,默认为""</param>
        public void PmCo2TvocAction(FrameLayout frame, Entity.Function device, string key, int title, int index, bool edit, string stateValue = "")
        {
            if (edit)
            if (edit)
            {
                ///
                this.function = device;
                Input inputs = Logic.currlogic.input[index];
                //清除之前旧数据
                dicSateteList.Clear();
@@ -677,12 +724,14 @@
                }
            }
            PublicInterface view = new PublicInterface();
            var listStr = view.GetViewList(key);
            view.SingleSelectionShow(frame, listStr, Language.StringByID(title), view.GetString(key, stateValue)
            //var listStr = view.GetViewList(key);
            var listStr = view.GetSensorLevelList(device);//2022年05月25日10:01:33 产品经理君煌要求改成动态
            view.SingleSelectionShow(frame, listStr, Language.StringByID(title), view.GetSensorLevelText(device, stateValue,true)
               , (text) =>
               {
                  
                   var value = view.GetValue(key, text);
                   //var value = view.GetValue(key, text);
                   var values = view.GetSensorLevelText(device,text,false);
                   selectedState = device.spk + "_" + key;
                   switch (device.spk)
                   {
@@ -700,7 +749,7 @@
                           }
                           break;
                   }
                   AddDictionary(key, value, "integer", "in");
                   AddDictionary(key, values, "integer", "in");
                   Save(device, index, edit);
               });
        }
@@ -854,6 +903,9 @@
        private bool Is_SpkAttribute(string key) {
            ///修改新属性
            ///识别使用功能是否存在属性
            if (this.function==null) {
                return false;
            }
            var job = this.function.GetAttribute(key);
            if (job != null)
            {