public override IDisposable TimePrompt(TimePromptConfig config) { 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; }; } if (config.Use24HourClock == true) { picker.TimePicker.ClockIdentifier = "24HourClock"; } 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( //config.UwpSubmitOnEnterKey, //config.UwpCancelOnEscKey, () => popup.IsOpen = true, () => popup.IsOpen = false )); }
public override IDisposable TimePrompt(TimePromptConfig config) { #if WINDOWS_PHONE_APP throw new NotImplementedException(); #else var picker = new TimePickerControl(); picker.TimePicker.MinuteIncrement = config.MinuteInterval; if (config.Use24HourClock.HasValue && config.Use24HourClock.Value) { picker.TimePicker.ClockIdentifier = "24HourClock"; } 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 }
/// <summary> Time prompt asynchronous. </summary> /// <param name="title"> (Optional) The title. </param> /// <param name="selectedTime"> (Optional) The selected time. </param> /// <param name="cancelToken"> (Optional) The cancel token. </param> /// <returns> The asynchronous result that yields an UserDialogTimePromptResult. </returns> public async Task <UserDialogTimePromptResult> TimePromptAsync(string title = null, TimeSpan?selectedTime = null, CancellationToken?cancelToken = null) { AcrDialogs.TimePromptResult result = await AcrDialogs.UserDialogs.Instance.TimePromptAsync(title, selectedTime, cancelToken); return(ConvertTimePromptResult(result)); }
/// <summary> Time prompt asynchronous. </summary> /// <param name="config"> The configuration. </param> /// <param name="cancelToken"> (Optional) The cancel token. </param> /// <returns> The asynchronous result that yields an UserDialogTimePromptResult. </returns> public async Task <UserDialogTimePromptResult> TimePromptAsync(UserDialogTimePromptConfig config, CancellationToken?cancelToken = null) { AcrDialogs.TimePromptResult result = await AcrDialogs.UserDialogs.Instance.TimePromptAsync(GetTimePromptConfig(config), cancelToken); return(ConvertTimePromptResult(result)); }
/// <summary> Convert time prompt result. </summary> /// <param name="result"> The result. </param> /// <returns> The time converted prompt result. </returns> private UserDialogTimePromptResult ConvertTimePromptResult(AcrDialogs.TimePromptResult result) { return((result == null) ? null : new UserDialogTimePromptResult(result.Ok, result.SelectedTime)); }