public DatePickerService() { var date = DateTime.Now; _datePickerDialog = new DatePickerDialog(Context, this, date.Year, date.Month - 1, date.Day); _datePickerDialog.SetOnCancelListener(this); _timePickerDialog = new TimePickerDialog(Context, this, date.Hour, date.Minute, true); _timePickerDialog.SetOnCancelListener(this); }
private Task <TimeSpan?> GetExecutionDelayAsync() { var tcs = new TaskCompletionSource <TimeSpan?>(); var timePicker = new TimePickerDialog(Activity, Resource.Style.TimeSpinnerDialogTheme, (o, args) => { var delay = new TimeSpan(args.HourOfDay, args.Minute, 0); if (delay.Equals(TimeSpan.Zero)) { delay = TimeSpan.FromMinutes(1); } tcs.TrySetResult(delay); }, 0, 1, true); timePicker.SetTitle("Delay"); timePicker.SetOnCancelListener(new DialogInterfaceOnCancelListener(() => { tcs.TrySetResult(null); })); timePicker.Show(); return(tcs.Task); }