陈嘉乐
2020-11-23 db68ee28e538f1de22db27216f194d131240f901
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,8 +143,18 @@
                LogicMethod.dictionary(dic, "data_type", "string");
                LogicMethod.dictionary(dic, "value", timepoint);
                inputTime.condition.Add(dic);
                //添加一个新的时间点条件
                Logic.currlogic.input.Add(inputTime);
                if (edit)
                {
                    //移除旧数据
                    Logic.currlogic.input.RemoveAt(index);
                    //新数据插入旧数据的位置;
                    Logic.currlogic.input.Insert(index, inputTime);
                }
                else
                {
                    //添加一个新的时间点条件
                    Logic.currlogic.input.Add(inputTime);
                }
                RemoveViewByTag("Logic");
                AddLogic addLogic = new AddLogic();
                MainPage.BasePageView.AddChidren(addLogic);
@@ -127,11 +163,12 @@
            };
        }
        /// <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 界面布局