陈嘉乐
2020-12-22 67d661b241f68641ba5ec78cedc10493ca2afd22
HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -63,16 +63,11 @@
                    break;
                //窗帘
                case FunctionType.Curtain:
                    {
                        //3表示(开,关,暂停)功能
                        SwitchView(fLayout, device, index, edit, 3);
                    }
                    break;
                case FunctionType.MotorCurtain:
                case FunctionType.RollingShutter:
                    {
                        //3表示(开,关,暂停)功能
                        SwitchBrightnessView(fLayout, device, index, edit, 3);
                        SwitchView(fLayout, device, index, edit, 3);
                    }
                    break;
                case FunctionType.AC:
@@ -418,6 +413,11 @@
                        ///模式点击事件
                        floorHeatingModehView.btnClick.MouseUpEventHandler += (sender, e) =>
                        {
                            FrameLayout frame = new FrameLayout
                            {
                                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                            };
                            this.AddChidren(frame);
                            List<string> modeStr = new List<string> {
                                Language.StringByID(StringId.dayMode),
                                 Language.StringByID(StringId.nightMode),
@@ -425,65 +425,21 @@
                                   Language.StringByID(StringId.ordinaryMode),
                                Language.StringByID(StringId.timeMode),
                            };
                            FrameLayout frame = new FrameLayout
                            {
                                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                            };
                            this.AddChidren(frame);
                            LogicView.DateView modeView = new LogicView.DateView();
                            modeView.btnTitle.TextID = StringId.modeLogic;
                            modeView.FLayoutView(frame, modeStr.Count);
                            modeView.btnCancel.MouseUpEventHandler += (sender2, e2) =>
                            {
                                frame.RemoveFromParent();
                            };
                            ///定义一个Btn记录选中状态
                            Button checkBtn = new Button
                            {
                                Tag = "unknown",
                            };
                            for (int i = 0; i < modeStr.Count; i++)
                            {
                                LogicView.CheckView modeTypeView = new LogicView.CheckView();
                                modeTypeView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i);
                                modeView.frameLayout.AddChidren(modeTypeView.FLayoutView());
                                modeTypeView.btnText.Text = modeStr[i];
                                modeTypeView.btnClick.Tag = modeStr[i];//标记
                            ///之前的状态文本
                            string currText= floorHeatingModehView.btnState.Text;
                            PublicInterface modeView = new PublicInterface();
                            modeView.SingleSelectionShow(frame, modeStr, Language.StringByID(StringId.modeLogic), currText
                               , (stateValue) =>
                               {
                                   string keyVlaue = "mode";
                                   Dictionary<string, string> dic = new Dictionary<string, string>();
                                   LogicMethod.dictionary(dic, "key", "mode");
                                   LogicMethod.dictionary(dic, "value", GetModeValueString(stateValue, "FloorHeating"));
                                   AddDictionaryData(dicSateteList, keyVlaue, dic);
                                   floorHeatingModehView.btnState.Text = stateValue;
                                   selectedState = device.functionType + "_mode";
                               });
                                if (floorHeatingModehView.btnState.Text == modeStr[i])
                                {
                                    //显示之前的选中状态
                                    checkBtn.IsSelected = false;
                                    modeTypeView.btnCheckIcon.IsSelected = true;
                                    checkBtn = modeTypeView.btnCheckIcon;
                                    checkBtn.Tag = modeTypeView.btnClick.Tag.ToString();
                                }
                                //星期的点击事件
                                modeTypeView.btnClick.MouseUpEventHandler += (sender1, e1) =>
                                {
                                    checkBtn.IsSelected = false;
                                    modeTypeView.btnCheckIcon.IsSelected = true;
                                    checkBtn = modeTypeView.btnCheckIcon;
                                    checkBtn.Tag = modeTypeView.btnClick.Tag.ToString();
                                };
                            }
                            modeView.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
                            {
                                if (checkBtn.Tag.ToString() == "unknown")
                                {
                                    return;
                                }
                                Dictionary<string, string> dic = new Dictionary<string, string>();
                                LogicMethod.dictionary(dic, "key", "mode");
                                string keyVlaue = "mode";
                                LogicMethod.dictionary(dic, "value", GetModeValueString(checkBtn.Tag.ToString(), "FloorHeating"));
                                floorHeatingModehView.btnState.Text = checkBtn.Tag.ToString();
                                selectedState = device.functionType + "_mode";
                                AddDictionaryData(dicSateteList, keyVlaue, dic);
                                RemView(frame);
                            };
                        };
                        if (edit)
                        {
@@ -894,6 +850,8 @@
                    }
                    break;
                case FunctionType.Curtain:
                case FunctionType.MotorCurtain:
                case FunctionType.RollingShutter:
                    {
                        foreach (var dic in dicList)
                        {
@@ -916,48 +874,6 @@
                                    }
                                    break;
                            }
                        }
                    }
                    break;
                case FunctionType.MotorCurtain:
                case FunctionType.RollingShutter:
                    {
                        foreach (var dic in dicList)
                        {
                            string value = dic["value"];
                            switch (dic["key"])
                            {
                                case "on_off":
                                    {
                                        switch (value)
                                        {
                                            case "on":
                                                {
                                                    button1.Text = Language.StringByID(StringId.onLogic);
                                                }
                                                break;
                                            case "off":
                                                {
                                                    button1.Text = Language.StringByID(StringId.offLogic);
                                                }
                                                break;
                                            case "stop":
                                                {
                                                    button1.Text = Language.StringByID(StringId.stop);
                                                }
                                                break;
                                        }
                                    }
                                    break;
                                case "percent":
                                    {
                                        button2.Text = value;
                                    }
                                    break;
                            }
                        }
                    }
                    break;