Ejemplo n.º 1
0
 /// <summary>
 /// Constructs the prompt options.
 /// </summary>
 /// <param name="prompt"> The prompt.</param>
 /// <param name="retry"> What to display on retry.</param>
 /// <param name="tooManyAttempts"> What to display when user didn't say a valid response after <see cref="Attempts"/>.</param>
 /// <param name="options"> The prompt choices.</param>
 /// <param name="attempts"> Maximum number of attempts.</param>
 /// <param name="promptStyler"> The prompt styler.</param>
 public PromptOptions(string prompt, string retry = null, string tooManyAttempts = null, IList <T> options = null, int attempts = 3, PromptStyler promptStyler = null)
 {
     SetField.NotNull(out this.Prompt, nameof(this.Prompt), prompt);
     this.Retry           = retry;
     this.TooManyAttempts = tooManyAttempts ?? this.DefaultTooManyAttempts;
     this.Attempts        = attempts;
     this.Options         = options;
     this.DefaultRetry    = prompt;
     if (promptStyler == null)
     {
         promptStyler = new PromptStyler();
     }
     this.PromptStyler = promptStyler;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructs the prompt options.
 /// </summary>
 /// <param name="prompt"> The prompt.</param>
 /// <param name="retry"> What to display on retry.</param>
 /// <param name="tooManyAttempts"> What to display when user didn't say a valid response after <see cref="Attempts"/>.</param>
 /// <param name="options"> The prompt choice values.</param>
 /// <param name="attempts"> Maximum number of attempts.</param>
 /// <param name="promptStyler"> The prompt styler.</param>
 /// <param name="descriptions">Descriptions for each prompt.</param>
 public PromptOptions(string prompt, string retry = null, string tooManyAttempts = null, IReadOnlyList <T> options = null, int attempts = 3, PromptStyler promptStyler = null, IReadOnlyList <string> descriptions = null, bool suppressRessourceTexts = false)
 {
     SetField.NotNull(out this.Prompt, nameof(this.Prompt), prompt);
     this.Retry           = retry;
     this.TooManyAttempts = tooManyAttempts ?? this.DefaultTooManyAttempts;
     this.Attempts        = attempts;
     this.Options         = options;
     this.Descriptions    = descriptions;
     this.DefaultRetry    = prompt;
     if (promptStyler == null)
     {
         promptStyler = new PromptStyler();
     }
     this.PromptStyler           = promptStyler;
     this.SuppressRessourceTexts = suppressRessourceTexts;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// <see cref="PromptStyler.Apply{T}(ref Message, string, IList{T})"/>.
        /// </summary>
        /// <typeparam name="T"> The type of the options.</typeparam>
        /// <param name="message"> The message.</param>
        /// <param name="prompt"> The prompt.</param>
        /// <param name="options"> The options.</param>
        /// <param name="promptStyle"> The prompt style.</param>
        public static void Apply <T>(ref Message message, string prompt, IList <T> options, PromptStyle promptStyle)
        {
            var styler = new PromptStyler(promptStyle);

            styler.Apply(ref message, prompt, options);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// <see cref="PromptStyler.Apply(ref IMessageActivity, string)"/>.
        /// </summary>
        /// <typeparam name="T"> The type of the options.</typeparam>
        /// <param name="message"> The message.</param>
        /// <param name="prompt"> The prompt.</param>
        /// <param name="options"> The options.</param>
        /// <param name="promptStyle"> The prompt style.</param>
        /// <param name="descriptions">Descriptions for each option.</param>
        public static void Apply <T>(ref IMessageActivity message, string prompt, IReadOnlyList <T> options, PromptStyle promptStyle, IReadOnlyList <string> descriptions = null)
        {
            var styler = new PromptStyler(promptStyle);

            styler.Apply(ref message, prompt, options, descriptions);
        }