Exemple #1
0
        /// <summary> Gets time prompt configuration. </summary>
        /// <exception cref="ArgumentNullException"> Thrown when one or more required arguments are null. </exception>
        /// <param name="config"> The configuration. </param>
        /// <returns> The time prompt configuration. </returns>
        private AcrDialogs.TimePromptConfig GetTimePromptConfig(UserDialogTimePromptConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            var result = new AcrDialogs.TimePromptConfig();

            if (config.Title != null)
            {
                result.Title = config.Title;
            }
            if (config.OkText != null)
            {
                result.OkText = config.OkText;
            }
            if (config.CancelText != null)
            {
                result.CancelText = config.CancelText;
            }
            if (config.Use24HourClock != null)
            {
                result.Use24HourClock = config.Use24HourClock;
            }
            if (config.SelectedTime != null)
            {
                result.SelectedTime = config.SelectedTime;
            }
            if (config.OnAction != null)
            {
                result.OnAction = GetTimePromptResultAction(config.OnAction);
            }
            if (config.IsCancellable != null)
            {
                result.IsCancellable = config.IsCancellable.Value;
            }
            if (config.MinimumMinutesTimeOfDay != null)
            {
                result.MinimumMinutesTimeOfDay = config.MinimumMinutesTimeOfDay;
            }
            if (config.MaximumMinutesTimeOfDay != null)
            {
                result.MaximumMinutesTimeOfDay = config.MaximumMinutesTimeOfDay;
            }
            if (config.MinuteInterval != null)
            {
                result.MinuteInterval = config.MinuteInterval.Value;
            }
            if (config.AndroidStyleId != null)
            {
                result.AndroidStyleId = config.AndroidStyleId;
            }

            return(result);
        }
Exemple #2
0
        /// <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));
        }
Exemple #3
0
 /// <summary> Time prompt. </summary>
 /// <param name="config"> The configuration. </param>
 /// <returns> An IDisposable. </returns>
 public IDisposable TimePrompt(UserDialogTimePromptConfig config)
 {
     return(AcrDialogs.UserDialogs.Instance.TimePrompt(GetTimePromptConfig(config)));
 }