public override IDisposable DatePrompt(DatePromptConfig config)
        {
            var picker = new AI.AIDatePickerController
            {
#if __IOS__
                Mode            = UIDatePickerMode.Date,
                DatePickerStyle = GetPickerStyle(config),
#endif
                SelectedDateTime = config.SelectedDate ?? DateTime.Now,
                OkText           = config.OkText,
                CancelText       = config.CancelText,
                Ok     = x => config.OnAction?.Invoke(new DatePromptResult(true, x.SelectedDateTime)),
                Cancel = x => config.OnAction?.Invoke(new DatePromptResult(false, x.SelectedDateTime)),
            };

            if (config.MaximumDate != null)
            {
                picker.MaximumDateTime = config.MaximumDate;
            }

            if (config.MinimumDate != null)
            {
                picker.MinimumDateTime = config.MinimumDate;
            }

            return(this.Present(picker));
        }
Exemplo n.º 2
0
        public override IDisposable TimePrompt(TimePromptConfig config)
        {
            var picker = new AI.AIDatePickerController
            {
                Mode             = UIDatePickerMode.Time,
                SelectedDateTime = config.SelectedTime != null?DateTime.Today.Add((TimeSpan)config.SelectedTime) : DateTime.Now,
                                       MinuteInterval = config.MinuteInterval,
                                       OkText         = config.OkText,
                                       CancelText     = config.CancelText,
                                       Ok             = x => config.OnAction?.Invoke(new TimePromptResult(true, x.SelectedDateTime.TimeOfDay)),
                                       Cancel         = x => config.OnAction?.Invoke(new TimePromptResult(false, x.SelectedDateTime.TimeOfDay)),
                                       Use24HourClock = config.Use24HourClock
            };

            return(this.Present(picker));
        }
Exemplo n.º 3
0
        public override IDisposable DatePrompt(DatePromptConfig config)
        {
            var picker = new AI.AIDatePickerController
            {
                Mode = UIDatePickerMode.Date,
                SelectedDateTime = config.SelectedDate ?? DateTime.Now,
                OkText = config.OkText,
                CancelText = config.CancelText,
                Ok = x => config.OnAction?.Invoke(new DatePromptResult (true, x.SelectedDateTime)),
                Cancel = x => config.OnAction?.Invoke(new DatePromptResult(false, x.SelectedDateTime)),
            };
            if (config.MaximumDate != null)
                picker.MaximumDateTime = config.MaximumDate;

            if (config.MinimumDate != null)
                picker.MinimumDateTime = config.MinimumDate;

            return this.Present(picker);
        }
Exemplo n.º 4
0
 public override IDisposable TimePrompt(TimePromptConfig config)
 {
     var picker = new AI.AIDatePickerController
     {
         Mode = UIDatePickerMode.Time,
         SelectedDateTime = config.SelectedTime != null ? DateTime.Today.Add ((TimeSpan)config.SelectedTime) : DateTime.Now,
         MinuteInterval = config.MinuteInterval,
         OkText = config.OkText,
         CancelText = config.CancelText,
         Ok = x => config.OnAction?.Invoke(new TimePromptResult(true, x.SelectedDateTime.TimeOfDay)),
         Cancel = x => config.OnAction?.Invoke(new TimePromptResult(false, x.SelectedDateTime.TimeOfDay)),
         Use24HourClock = config.Use24HourClock
     };
     return this.Present(picker);
 }