old mode 100755
new mode 100644
| | |
| | | /// <param name="index">编辑条件的索引</param> |
| | | public void TimePoint(FrameLayout fLayout, bool edit, int index) |
| | | { |
| | | LogicView.TimeView timePointView = new LogicView.TimeView(); |
| | | timePointView.FLayoutView(fLayout); |
| | | EventHandler<MouseEventArgs> removefLayout = (sender, e1) => |
| | | { |
| | | //移除fLayout界面 |
| | | fLayout.RemoveFromParent(); |
| | | }; |
| | | //取消点击事件 |
| | | timePointView.btnCancel.MouseUpEventHandler += removefLayout; |
| | | |
| | | //加载数据界面的设置方法(列表互不联动) |
| | | timePointView.mUIPickerView.setNPicker(timePointView.GethStringList(), timePointView.GetmStringList(), null); |
| | | |
| | | var systemHour = DateTime.Now.Hour; //获取小时 |
| | | var systeMinute = DateTime.Now.Minute;//获取分钟 |
| | | int systemHourIndex = 0; |
| | | int systeMinuteIndex = 0; |
| | | for (int i = 0; i < timePointView.GethIntList().Count; i++) |
| | | { |
| | | var currhour = timePointView.GethIntList()[i]; |
| | | if (systemHour == currhour) |
| | | { |
| | | systemHourIndex = i; |
| | | break; |
| | | } |
| | | } |
| | | for (int i = 0; i < timePointView.GetmIntList().Count; i++) |
| | | { |
| | | var currminute = timePointView.GetmIntList()[i]; |
| | | if (systeMinute == currminute) |
| | | { |
| | | systeMinuteIndex = i; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //默认初始选中状态 |
| | | timePointView.mUIPickerView.setCurrentItems(systemHourIndex, systeMinuteIndex, 0); |
| | | string currH = ""; |
| | | string currM = ""; |
| | | if (systemHour < 10) |
| | | { |
| | | currH = "0" + systemHour.ToString(); |
| | | } |
| | | else |
| | | { |
| | | currH = systemHour.ToString(); |
| | | } |
| | | if (systeMinute < 10) |
| | | { |
| | | currM = "0" + systeMinute.ToString(); |
| | | } |
| | | else |
| | | { |
| | | currM = systeMinute.ToString(); |
| | | } |
| | | //定义一个局部变量记录选中时间 |
| | | string timepoint = currH + ":" + currM; |
| | | //编辑之前的时间状态值 |
| | | string editTime= ""; |
| | | if (edit) |
| | | { |
| | | Input inputs = Logic.currlogic.input[index]; |
| | |
| | | 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, mIndex, 0); |
| | | timepoint = timeValue; |
| | | editTime = timeValue; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //选中时间回调方法,时间变化一次回调一次 |
| | | timePointView.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) => |
| | | { |
| | | string hour = timePointView.GethStringList()[index1].Split(' ')[0]; |
| | | string minuet = timePointView.GetmStringList()[index2].Split(' ')[0]; |
| | | timepoint = hour + ":" + minuet; |
| | | }; |
| | | //确定点击事件 |
| | | timePointView.btnConfirm.MouseUpEventHandler += (sender, e3) => |
| | | { |
| | | LogicView.TimeView timePointView = new LogicView.TimeView(); |
| | | timePointView.FLayoutView(fLayout); |
| | | timePointView.TimePoint(fLayout, editTime, (timeValue)=>{ |
| | | Input inputTime = new Input(); |
| | | inputTime.sid = LogicMethod.NewSid(); |
| | | inputTime.condition_type = "1"; |
| | |
| | | LogicMethod.dictionary(dic, "key", "timepoint"); |
| | | LogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.dictionary(dic, "value", timepoint); |
| | | LogicMethod.dictionary(dic, "value", timeValue); |
| | | inputTime.condition.Add(dic); |
| | | 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(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | |
| | | }; |
| | | AddCondition(inputTime, edit, index); |
| | | }); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 时间范围方法 |
| | |
| | | LogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.dictionary(dic, "value", btnStartTimeText.Text + "-" + btnEndTimeText.Text); |
| | | inputTime.condition.Add(dic); |
| | | if (edit) |
| | | { |
| | | //移除旧数据 |
| | | Logic.currlogic.input.RemoveAt(index); |
| | | //新数据插入旧数据的位置 |
| | | Logic.currlogic.input.Insert(index, inputTime); |
| | | fLayout.RemoveFromParent(); |
| | | } |
| | | else |
| | | { |
| | | //添加一个新的时间点条件 |
| | | Logic.currlogic.input.Add(inputTime); |
| | | } |
| | | LogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | AddCondition(inputTime, edit, index); |
| | | |
| | | |
| | | }; |
| | |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 设置时间段时间的方法 |
| | | /// 设置时间段值 |
| | | /// </summary> |
| | | /// <param name="fLayout"></param> |
| | | /// <param name="btn"></param> |
| | | public void SelectedTimeHorizon(FrameLayout fLayout, Button btn) |
| | | { |
| | | |
| | | LogicView.TimeView timePointView = new LogicView.TimeView(); |
| | | timePointView.FLayoutView(fLayout); |
| | | EventHandler<MouseEventArgs> RemovefLayout = (sender, e1) => |
| | | { |
| | | //只移除时间弹窗界面 |
| | | timePointView.frameLayout.RemoveFromParent(); |
| | | }; |
| | | //取消点击事件 |
| | | timePointView.btnCancel.MouseUpEventHandler += RemovefLayout; |
| | | //加载数据界面的设置方法(列表互不联动) |
| | | timePointView.mUIPickerView.setNPicker(timePointView.GethStringList(), timePointView.GetmStringList(), null); |
| | | |
| | | var systemHour = DateTime.Now.Hour; //获取小时 |
| | | var systeMinute = DateTime.Now.Minute;//获取分钟 |
| | | int systemHourIndex = 0; |
| | | int systeMinuteIndex = 0; |
| | | for (int i = 0; i < timePointView.GethIntList().Count; i++) |
| | | { |
| | | var currhour = timePointView.GethIntList()[i]; |
| | | if (systemHour == currhour) |
| | | { |
| | | systemHourIndex = i; |
| | | break; |
| | | } |
| | | } |
| | | for (int i = 0; i < timePointView.GetmIntList().Count; i++) |
| | | { |
| | | var currminute = timePointView.GetmIntList()[i]; |
| | | if (systeMinute == currminute) |
| | | { |
| | | systeMinuteIndex = i; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //默认初始选中状态 |
| | | timePointView.mUIPickerView.setCurrentItems(systemHourIndex, systeMinuteIndex, 0); |
| | | string currH = ""; |
| | | string currM = ""; |
| | | if (systemHour < 10) |
| | | { |
| | | currH = "0" + systemHour.ToString(); |
| | | } |
| | | else |
| | | { |
| | | currH = systemHour.ToString(); |
| | | } |
| | | if (systeMinute < 10) |
| | | { |
| | | currM = "0" + systeMinute.ToString(); |
| | | } |
| | | else |
| | | { |
| | | currM = systeMinute.ToString(); |
| | | } |
| | | //定义一个局部变量记录选中时间 |
| | | string timepoint = currH + ":" + currM; |
| | | int sumTime = systemHour*60+ systeMinute; |
| | | |
| | | //编辑之前的时间状态值 |
| | | string editTime = ""; |
| | | if (btn.Tag.ToString() != "0") |
| | | { |
| | | string h = "", m = ""; |
| | | sumTime = int.Parse(btn.Tag.ToString()); |
| | | int sumTime = int.Parse(btn.Tag.ToString()); |
| | | if ((sumTime / 60) < 10) |
| | | { |
| | | h = "0" + (sumTime / 60).ToString(); |
| | |
| | | { |
| | | m = (sumTime % 60).ToString(); |
| | | } |
| | | timepoint = h + ":" + m; |
| | | |
| | | int hourIndex = timePointView.GetValueIndex(timepoint, 0, 1, timePointView.GethIntList()); |
| | | int minuteIndex = timePointView.GetValueIndex(timepoint, 1, 0, timePointView.GetmIntList()); |
| | | //更新状态 |
| | | timePointView.mUIPickerView.setCurrentItems(hourIndex, minuteIndex, 0); |
| | | editTime = h + ":" + m; |
| | | } |
| | | |
| | | //选中时间回调方法,时间变化一次回调一次 |
| | | timePointView.mUIPickerView.OnSelectChangeEvent += (index1, index2, index3) => |
| | | LogicView.TimeView timePointView = new LogicView.TimeView(); |
| | | timePointView.FLayoutView(fLayout); |
| | | timePointView.TimePoint(timePointView.frameLayout, editTime, (timeValue) => |
| | | { |
| | | |
| | | string hour = timePointView.GethStringList()[index1].Split(' ')[0]; |
| | | string minuet = timePointView.GetmStringList()[index2].Split(' ')[0]; |
| | | timepoint = hour + ":" + minuet; |
| | | sumTime = int.Parse(hour) * 60 + int.Parse(minuet); |
| | | |
| | | |
| | | }; |
| | | //确定点击事件 |
| | | timePointView.btnConfirm.MouseUpEventHandler += (sender1, e3) => |
| | | { |
| | | btn.Tag = sumTime; |
| | | btn.Text = timepoint; |
| | | //只移除时间弹窗界面 |
| | | timePointView.frameLayout.RemoveFromParent(); |
| | | }; |
| | | int hour = int.Parse(timeValue.Split(':')[0]); |
| | | int minuet = int.Parse(timeValue.Split(':')[1]); |
| | | int intValueTag = hour * 60 + minuet; |
| | | //标记值,用于比较开始时间和结束时间大小; |
| | | btn.Tag = intValueTag; |
| | | //显示时间文本 |
| | | btn.Text = timeValue; |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加条件 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | private void AddCondition(Input input,bool edit,int index) |
| | | { |
| | | if (edit) |
| | | { |
| | | //移除旧数据 |
| | | Logic.currlogic.input.RemoveAt(index); |
| | | //新数据插入旧数据的位置 |
| | | Logic.currlogic.input.Insert(index, input); |
| | | } |
| | | else |
| | | { |
| | | //添加一个新的时间条件 |
| | | Logic.currlogic.input.Add(input); |
| | | } |
| | | LogicMethod.RemoveAllView(); |
| | | AddLogic addLogic = new AddLogic(); |
| | | MainPage.BasePageView.AddChidren(addLogic); |
| | | addLogic.Show(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 灰色弹框父控件 |
| | | /// </summary> |