wxr
2023-08-23 96e9ff2e5a54f54cdbb6b8b2f049fdf6a837de3c
OnPro/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
@@ -36,13 +36,6 @@
            sceneView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png";
            viewLayout.AddChidren(sceneView.FLayoutView());
            //安防
            LogicView.SelectTypeView securityView = new LogicView.SelectTypeView();
            securityView.frameLayout.Y = sceneView.frameLayout.Bottom;
            securityView.btnText.TextID = StringId.anfang;
            securityView.btnIcon.UnSelectedImagePath = "LogicIcon/security.png";
            viewLayout.AddChidren(securityView.FLayoutView());
            //延时
            LogicView.SelectTypeView delayView = new LogicView.SelectTypeView();
            delayView.frameLayout.Y = sceneView.frameLayout.Bottom;
@@ -52,32 +45,10 @@
            var colorfulRgbList = FunctionList.List.GetLightList().FindAll((obj) => obj.spk == SPK.LightRGB
            && obj.GetAttributes().Contains(FunctionAttributeKey.Colorful));
            //var seriesList = FunctionList.List.GetSeries();
            if (colorfulRgbList.Count > 0 || FunctionList.List.GetSeries().Count>0)
            {
                LogicView.SelectTypeView seriesView = new LogicView.SelectTypeView();
                seriesView.frameLayout.Y = securityView.frameLayout.Bottom;
                seriesView.btnText.TextID = StringId.HorseRaceLamp;
                seriesView.btnIcon.UnSelectedImagePath = "FunctionIcon/Icon/HorseRaceLampIcon.png";
                viewLayout.AddChidren(seriesView.FLayoutView());
                seriesView.btnClick.MouseUpEventHandler = (sender, e) =>
                {
                    var settingPage = new LogicSeriesSettingPage();
                    MainPage.BasePageView.AddChidren(settingPage);
                    settingPage.LoadPage(colorfulRgbList);
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                };
                new FunTpye(LogicMethod.target_if).FunTypeView(viewLayout, seriesView.frameLayout.Bottom, 3);
            }
            else
            {
                ////功能
                ///产品经理君焕要求,设备功能移到这里。<2022-3-7>
                new FunTpye(LogicMethod.target_if).FunTypeView(viewLayout, securityView.frameLayout.Bottom, 2);
            }
                new FunTpye(LogicMethod.target_if).FunTypeView(viewLayout, sceneView.frameLayout.Bottom, 2);
            #endregion
            #region  所有点击事件
@@ -85,16 +56,6 @@
            sceneView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                SceneMethod();
            };
            //安防点击事件
            securityView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                Security security = new Security();
                MainPage.BasePageView.AddChidren(security);
                security.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                //SecurityMethod(this);
            };
            //延时点击事件
            delayView.btnClick.MouseUpEventHandler += (sen, e) =>
@@ -132,41 +93,6 @@
                //没啥作用,为了发送数据格式统一;
                outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "scene" }, { "value", "0" } } };
                AddOutput(outputDevice);
                LogicMethod.Current.RemoveAllView();
                AddLogic addLogic = new AddLogic();
                MainPage.BasePageView.AddChidren(addLogic);
                addLogic.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            });
        }
        /// <summary>
        /// 添加安防
        /// </summary>
        public void SecurityMethod(FrameLayout frameLayout, bool edit=false, int index1=-1)
        {
            List<string> stateList = new List<string>();
            if (edit&& index1 != -1) {
                Output output = Logic.currlogic.output[index1];
                var security = LogicMethod.Current.GetSecurity(output.sid);
                stateList.Add(security.name);
            }
            var securityList = LogicMethod.Current.GetSecurityList();
            List<string> nameList = new List<string>();
            for (int i = 0; i < securityList.Count; i++)
            {
                var security = securityList[i];
                nameList.Add(security.name);
            }
            PublicInterface publicInterface = new PublicInterface();
            publicInterface.FrameOrVv(frameLayout, nameList, stateList,Language.StringByID(StringId.addSecurityLogic),(index) =>
            {
                var securitySelecetd = securityList[index];
                Output outputDevice = new Output();
                outputDevice.target_type = "3";
                outputDevice.sid = securitySelecetd.sid;
                //没啥作用,为了发送数据格式统一;
                outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "security" }, { "value", "0" } } };
                AddOutput(outputDevice,true);
                LogicMethod.Current.RemoveAllView();
                AddLogic addLogic = new AddLogic();
                MainPage.BasePageView.AddChidren(addLogic);