陈嘉乐
2020-12-03 0f2e0147e8990e913d16d99bc1b94fb6bc53abd7
HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs
@@ -12,7 +12,7 @@
        public void Show()
        {
            #region  界面布局
            LogicView.TopView topView = new LogicView.TopView();
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
@@ -49,17 +49,19 @@
            timeHorizonView.btnText.TextID = StringId.timeHorizon;
            viewLayout.AddChidren(timeHorizonView.FLayoutView());
            #endregion
            #region  时间点  时间范围点击事件
            //时间点点击事件
            timepointView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                //主界面控件
                FrameLayout fLayout = new FrameLayout
                {
                    BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                };
                this.AddChidren(fLayout);
                TimePoint(fLayout);
                TimePoint(fLayout, false, 100);
            };
            //时间范围点击事件
@@ -72,15 +74,19 @@
                };
                //添加主界面
                this.AddChidren(fLayout);
                TimeHorizon(fLayout,false,0);
                TimeHorizon(fLayout, false, 0);
            };
            #endregion
        }
        /// <summary>
        /// 时间点方法
        /// </summary>
        /// <param name="fLayout">在哪个界面显示</param>
        public void TimePoint(FrameLayout fLayout)
        /// <param name="edit">(true=编辑;false=新建)</param>
        /// <param name="index">编辑条件的索引</param>
        public void TimePoint(FrameLayout fLayout, bool edit, int index)
        {
            LogicView.TimeView timePointView = new LogicView.TimeView();
            timePointView.FLayoutView(fLayout);
@@ -98,6 +104,26 @@
            timePointView.mUIPickerView.setCurrentItems(0, 30, 0);
            //定义一个局部变量记录选中时间
            string timepoint = "01:30";
            if (edit)
            {
                Input inputs = Logic.currlogic.input[index];
                if (inputs.condition_type == "1")
                {
                    List<Dictionary<string, string>> dicList = inputs.condition as List<Dictionary<string, string>>;
                    foreach (var dic in dicList)
                    {
                        string timeValue = dic["value"];
                        int hIndex = timePointView.GetValueIndex(timeValue, 0, 1, timePointView.GethIntList());
                        int mIndex = timePointView.GetValueIndex(timeValue, 1, 0, timePointView.GetmIntList());
                        //更新初始状态
                        timePointView.mUIPickerView.setCurrentItems(hIndex - 1, mIndex, 0);
                        timepoint = timeValue;
                    }
                }
            }
            //选中时间回调方法,时间变化一次回调一次
            timePointView.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) =>
            {
@@ -117,9 +143,19 @@
                LogicMethod.dictionary(dic, "data_type", "string");
                LogicMethod.dictionary(dic, "value", timepoint);
                inputTime.condition.Add(dic);
                //添加一个新的时间点条件
                Logic.currlogic.input.Add(inputTime);
                RemoveViewByTag("Logic");
                if (edit)
                {
                    //移除旧数据
                    Logic.currlogic.input.RemoveAt(index);
                    //新数据插入旧数据的位置;
                    Logic.currlogic.input.Insert(index, inputTime);
                }
                else
                {
                    //添加一个新的时间点条件
                    Logic.currlogic.input.Add(inputTime);
                }
                LogicMethod.RemoveAllView();
                AddLogic addLogic = new AddLogic();
                MainPage.BasePageView.AddChidren(addLogic);
                addLogic.Show();
@@ -127,16 +163,16 @@
            };
        }
        /// <summary>
        /// 时间范围方法
        /// </summary>
        /// <param name="fLayout">在哪个界面显示</param>
        /// <param name="edit">(true=编辑;false=新建)</param>
        /// <param name="index">编辑条件的索引</param>
        public void TimeHorizon(FrameLayout fLayout,bool edit,int index)
        {
            #region 界面布局
            LogicView.TimeHorizonView timeHorizonView = new LogicView.TimeHorizonView();
            timeHorizonView.frameLayout.SetCornerWithSameRadius(12, HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight | HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
            timeHorizonView.FLayoutView(fLayout);
            //开始时间
            LogicView.SelectTypeView startTimeView = new LogicView.SelectTypeView();
@@ -163,7 +199,7 @@
            //结束时间
            LogicView.SelectTypeView endTimeView = new LogicView.SelectTypeView();
            endTimeView.frameLayout.SetCornerWithSameRadius(12, HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
            endTimeView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
            endTimeView.frameLayout.Y = startTimeView.frameLayout.Bottom;
            endTimeView.btnIcon.Visible = false;
            endTimeView.btnLine.Visible = false;
@@ -243,7 +279,7 @@
                    //添加一个新的时间点条件
                    Logic.currlogic.input.Add(inputTime);
                }
                RemoveViewByTag("Logic");
                LogicMethod.RemoveAllView();
                AddLogic addLogic = new AddLogic();
                MainPage.BasePageView.AddChidren(addLogic);
                addLogic.Show();