コード例 #1
0
ファイル: PromptDialog.cs プロジェクト: domsteil/BotBuilder
 /// <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;
 }
コード例 #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;
 }
コード例 #3
0
ファイル: PromptDialog.cs プロジェクト: domsteil/BotBuilder
        /// <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);
        }
コード例 #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);
        }