| | |
| | | /// 选择的时间 |
| | | /// </summary> |
| | | private DateTime selectDateTime; |
| | | /// <summary> |
| | | /// 时间校验 |
| | | /// 是否需要校验时间大于当前时间 |
| | | /// </summary> |
| | | public bool TimeCheck = false; |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | this.ClearBodyFrame(); |
| | | |
| | | //选择日期 |
| | | var rowDate = new RowLayoutControl(); |
| | | var rowDate = new FrameLayout() { |
| | | Height = Application.GetRealHeight(50), |
| | | }; |
| | | rowDate.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | bodyFrameLayout.AddChidren(rowDate); |
| | | rowDate.frameTable.AddLeftCaption(Language.StringByID(StringId.SelectDate), 300); |
| | | rowDate.frameTable.AddRightArrow(); |
| | | rowDate.frameTable.AddBottomLine(); |
| | | var btnDay = rowDate.frameTable.AddMostRightView(this.selectDateTime.ToString("yyyy.MM.dd"), 300); |
| | | rowDate.frameTable.ButtonClickEvent += (sender, e) => |
| | | var btnDateLeft = new Button() |
| | | { |
| | | TextID = StringId.SelectDate, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Width = Application.GetRealWidth(300), |
| | | X = Application.GetRealWidth(16), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | }; |
| | | rowDate.AddChidren(btnDateLeft); |
| | | var btnDateRight = new Button() |
| | | { |
| | | X = Application.GetRealWidth(339), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetMinRealAverage(16), |
| | | Height = Application.GetMinRealAverage(16), |
| | | UnSelectedImagePath = "Public/Right.png", |
| | | }; |
| | | rowDate.AddChidren(btnDateRight); |
| | | rowDate.AddChidren(new Button() { X = Application.GetRealWidth(16),Y = Application.GetRealHeight(49), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | var btnDay = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(327), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | Text = selectDateTime.ToString("yyyy.MM.dd"), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | }; |
| | | rowDate.AddChidren(btnDay); |
| | | EventHandler<MouseEventArgs> dateEvent = (sender, e) => |
| | | { |
| | | //显示日期选择的底部弹窗 |
| | | var contr = new BottomDateSelectControl(); |
| | | contr.InitControl(this.selectDateTime.Year, this.selectDateTime.Month, this.selectDateTime.Day, 1, 1); |
| | | contr.InitControl(this.selectDateTime.Year, this.selectDateTime.Month, this.selectDateTime.Day, 0, 1); |
| | | contr.FinishEvent += (div, year, month, day) => |
| | | { |
| | | //覆盖时间 |
| | |
| | | } |
| | | }; |
| | | }; |
| | | btnDateLeft.MouseUpEventHandler = dateEvent; |
| | | btnDateRight.MouseUpEventHandler = dateEvent; |
| | | btnDay.MouseUpEventHandler = dateEvent; |
| | | |
| | | //选择时间 |
| | | var rowTime = new RowLayoutControl(); |
| | | rowTime.Y = rowDate.Bottom; |
| | | rowTime.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | var rowTime = new FrameLayout() { |
| | | Y = rowDate.Bottom, |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | bodyFrameLayout.AddChidren(rowTime); |
| | | rowTime.frameTable.AddLeftCaption(Language.StringByID(StringId.SelectTime), 300); |
| | | rowTime.frameTable.AddRightArrow(); |
| | | var btnTime = rowTime.frameTable.AddMostRightView(this.selectDateTime.ToString("HH:mm"), 300); |
| | | rowTime.frameTable.ButtonClickEvent += (sender, e) => |
| | | rowTime.AddChidren(new Button() { X = Application.GetRealWidth(16),Y = Application.GetRealHeight(49), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); |
| | | var btnTimeLeft = new Button() |
| | | { |
| | | TextID = StringId.SelectTime, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Width = Application.GetRealWidth(300), |
| | | X = Application.GetRealWidth(16), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | }; |
| | | rowTime.AddChidren(btnTimeLeft); |
| | | var btnTimeRight = new Button() |
| | | { |
| | | X = Application.GetRealWidth(339), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetMinRealAverage(16), |
| | | Height = Application.GetMinRealAverage(16), |
| | | UnSelectedImagePath = "Public/Right.png", |
| | | }; |
| | | rowTime.AddChidren(btnTimeRight); |
| | | var btnTime = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(327), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | Text = selectDateTime.ToString("HH:mm"), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | }; |
| | | rowTime.AddChidren(btnTime); |
| | | EventHandler<MouseEventArgs> timeEvent = (sender, e) => |
| | | { |
| | | //显示日期选择的底部弹窗 |
| | | var contr = new BottomTimeSelectControl(); |
| | | contr.RowCount = 5; |
| | | contr.InitControl(this.selectDateTime.Hour, this.selectDateTime.Minute, -1); |
| | | contr.RowCount = 4; |
| | | contr.InitControl(this.selectDateTime.Hour, this.selectDateTime.Minute,250); |
| | | contr.FinishEvent += (div, hour, minute) => |
| | | { |
| | | //覆盖时间 |
| | |
| | | } |
| | | }; |
| | | }; |
| | | btnTimeLeft.MouseUpEventHandler = timeEvent; |
| | | btnTimeRight.MouseUpEventHandler = timeEvent; |
| | | btnTime.MouseUpEventHandler = timeEvent; |
| | | } |
| | | |
| | | #endregion |
| | |
| | | /// </summary> |
| | | public override void CloseFormBefore() |
| | | { |
| | | if (TimeCheck) |
| | | { |
| | | if (DateTime.Now > this.selectDateTime) |
| | | { |
| | | new PublicAssmebly().TipMsg(StringId.Tip, StringId.TempPwdSettingTip); |
| | | throw new Exception("stop"); |
| | | } |
| | | } |
| | | base.CloseFormBefore(); |
| | | //调用回调事件 |
| | | this.SelectFinshEvent?.Invoke(this.selectDateTime); |