public static Dialog Build(Activity activity, TimePromptConfig config) { var themeId = config.AndroidStyleId ?? 0; var is24Hour = config.Use24HourClock ?? DateFormat.Is24HourFormat(activity); var timePickerDialog = new TimePickerDialog(activity, themeId, (sender, args) => { var ts = new TimeSpan(0, args.HourOfDay, args.Minute, 0); config.OnAction?.Invoke(new TimePromptResult(true, ts)); }, config.SelectedTime.Value.Hours, config.SelectedTime.Value.Minutes, is24Hour); return(timePickerDialog); }
public static Dialog Build(Activity activity, TimePromptConfig config) { var picker = new TimePicker(activity); var builder = new AlertDialog .Builder(activity) .SetCancelable(false) .SetTitle(config.Title) .SetView(picker); if (config.SelectedTime != null) { picker.CurrentHour = new Integer(config.SelectedTime.Value.Hours); picker.CurrentMinute = new Integer(config.SelectedTime.Value.Minutes); } var is24Hour = config.Use24HourClock ?? DateFormat.Is24HourFormat(activity); picker.SetIs24HourView(new Java.Lang.Boolean(is24Hour)); if (config.IsCancellable) { builder.SetNegativeButton( config.CancelText, (sender, args) => { var ts = new TimeSpan(0, picker.CurrentHour.IntValue(), picker.CurrentMinute.IntValue(), 0); config.OnAction?.Invoke(new TimePromptResult(false, ts)); } ); } builder.SetPositiveButton( config.OkText, (sender, args) => { var ts = new TimeSpan(0, picker.CurrentHour.IntValue(), picker.CurrentMinute.IntValue(), 0); config.OnAction?.Invoke(new TimePromptResult(true, ts)); } ); return(builder.Show()); }
public static Dialog Build(Activity activity, TimePromptConfig config) { var picker = new TimePicker(activity); var builder = new AlertDialog .Builder(activity) .SetCancelable(false) .SetTitle(config.Title) .SetView(picker); if (config.SelectedTime != null) { picker.CurrentHour = new Integer(config.SelectedTime.Value.Hours); picker.CurrentMinute = new Integer(config.SelectedTime.Value.Minutes); } var is24Hour = config.Use24HourClock ?? DateFormat.Is24HourFormat (activity); picker.SetIs24HourView(new Java.Lang.Boolean(is24Hour)); if (config.IsCancellable) { builder.SetNegativeButton( config.CancelText, (sender, args) => { var ts = new TimeSpan(0, picker.CurrentHour.IntValue(), picker.CurrentMinute.IntValue(), 0); config.OnAction?.Invoke(new TimePromptResult(false, ts)); } ); } builder.SetPositiveButton( config.OkText, (sender, args) => { var ts = new TimeSpan(0, picker.CurrentHour.IntValue(), picker.CurrentMinute.IntValue(), 0); config.OnAction?.Invoke(new TimePromptResult(true, ts)); } ); return builder.Show(); }
public override IDisposable TimePrompt(TimePromptConfig config) { Dispatch(() => { var timePromptControl = new TimePromptControl() { Use24HourClock = config.Use24HourClock ?? false, Value = config.SelectedTime ?? TimeSpan.Zero }; FormsContentDialog dialog = new FormsContentDialog() { DataContext = config, Title = config.Title, Content = timePromptControl, IsPrimaryButtonEnabled = true, PrimaryButtonText = config.OkText, IsSecondaryButtonEnabled = true, SecondaryButtonText = config.CancelText }; dialog.PrimaryButtonClick += (s, e) => { HideContentDialog(); config.OnAction(new TimePromptResult(true, timePromptControl.Value)); e.Cancel = true; }; dialog.SecondaryButtonClick += (s, e) => { HideContentDialog(); config.OnAction(new TimePromptResult(false, timePromptControl.Value)); e.Cancel = true; }; ShowContentDialog(dialog); }); return(new DisposableAction(HideContentDialog)); }
public override IDisposable TimePrompt(TimePromptConfig config) { throw new NotImplementedException(); }
public Task <TimePromptResult> TimePromptAsync(TimePromptConfig config, CancellationToken?cancelToken = null) { return(UserDialogs.Instance.TimePromptAsync(config, cancelToken)); }
public Task <TimePromptResult> TimePromptAsync(TimePromptConfig config, CancellationToken?cancelToken = null) { return(null); }
public IDisposable TimePrompt(TimePromptConfig config) { return(null); }
public Task <TimePromptResult> TimePromptAsync(TimePromptConfig config, CancellationToken?cancelToken = default(CancellationToken?)) { return(Task.FromResult(new TimePromptResult(true, DateTime.Now.TimeOfDay))); }
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); }
public IDisposable TimePrompt(TimePromptConfig config) { return(new DisposableMock()); }
public Task <TimePromptResult> TimePromptAsync(TimePromptConfig config, CancellationToken?cancelToken = null) { throw new NotImplementedException(); }
public override IDisposable TimePrompt(TimePromptConfig config) { throw new NotImplementedException(); }
public override IDisposable TimePrompt(TimePromptConfig config) { #if WINDOWS_PHONE_APP throw new NotImplementedException(); #else var picker = new TimePickerControl(); picker.TimePicker.MinuteIncrement = config.MinuteInterval; var popup = this.CreatePopup(picker); if (!config.IsCancellable) picker.CancelButton.Visibility = Visibility.Collapsed; else { picker.CancelButton.Content = config.CancelText; picker.CancelButton.Click += (sender, args) => { var result = new TimePromptResult(false, picker.TimePicker.Time); config.OnAction?.Invoke(result); popup.IsOpen = false; }; } picker.OkButton.Content = config.OkText; picker.OkButton.Click += (sender, args) => { var result = new TimePromptResult(true, picker.TimePicker.Time); config.OnAction?.Invoke(result); popup.IsOpen = false; }; if (config.SelectedTime != null) { picker.TimePicker.Time = config.SelectedTime.Value; } return this.DispatchAndDispose( () => popup.IsOpen = true, () => popup.IsOpen = false ); #endif }
public IDisposable TimePrompt(TimePromptConfig config) => UserDialogs.Instance.TimePrompt(config);