Exemple #1
0
 public PromptDateTime(IPromptOptions <string> promptOptions, string pattern) : base(promptOptions)
 {
     Patterns = (string.IsNullOrEmpty(pattern)) ? new List <string>() : new List <string>()
     {
         pattern
     };
 }
Exemple #2
0
 public PromptText(IPromptOptions <string> promptOptions, string pattern, RegexOptions regexOption) : base(promptOptions)
 {
     Patterns = (string.IsNullOrEmpty(pattern)) ? new List <string>() : new List <string>()
     {
         pattern
     };
     Option = regexOption;
 }
Exemple #3
0
        public PromptAdaptiveCard(AdaptiveCard card, IPromptOptions <string> promptOptions, bool isRememberUserInput, PromptAdaptiveCardVaildateDelegate vaildDelegate)
        {
            SetField.NotNull(out this.promptOptions, nameof(promptOptions), promptOptions);

            // 是否記住使用者輸入的Form
            IsRememberUserInput = isRememberUserInput;

            // 卡片內容轉成JSON字串
            CardContent = JsonConvert.SerializeObject(card ?? new AdaptiveCard());

            // 設定Adaptive Card資料驗證Callback
            VaildateResult = vaildDelegate;
        }
    public static void Text(IDialogContext context, ResumeAfter <string> resume, IPromptOptions <string> promptOptions)
    {
        var child = new PromptString(promptOptions);

        context.Call <string>(child, resume);
    }
 public TimeRelatedPromptDialog(IPromptOptions <string> promptOptions, Action <T> onCompleted) : base(promptOptions)
 {
     OnCompleted = onCompleted;
 }
Exemple #6
0
 public PromptText(IPromptOptions <string> promptOptions, IEnumerable <string> patterns, RegexOptions regexOption) : base(promptOptions)
 {
     Patterns = (patterns == null) ? new List <string>() : new List <string>(patterns);
     Option   = regexOption;
 }
Exemple #7
0
 public PromptDateTime(IPromptOptions <string> promptOptions, IEnumerable <string> patterns) : base(promptOptions)
 {
     Patterns = (patterns == null) ? new List <string>() : new List <string>(patterns);
 }
        // Choice
        public static void Choice <T>(IDialogContext context, ResumeAfter <T> resume, IPromptOptions <T> promptOptions, bool isAdaptiveCard = true, PromptStyle promptStyle = PromptStyle.Auto, bool recognizeChoices = true, bool recognizeNumbers = true, bool recognizeOrdinals = true, double minScore = 0.4)
        {
            IPromptOptions <T> adPromptOptions;

            if (promptOptions.GetType() == typeof(PromptOptions <T>))
            {
                adPromptOptions = new PromptOptions <T>(promptOptions.Prompt,
                                                        promptOptions.Retry,
                                                        attempts: promptOptions.Attempts,
                                                        options: promptOptions.Options.ToList(),
                                                        promptStyler: new AdaptivePromptStyler(promptStyle, isAdaptiveCard),
                                                        descriptions: promptOptions.Descriptions?.ToList());
            }
            else
            {
                adPromptOptions = new PromptOptionsWithSynonyms <T>(promptOptions.Prompt,
                                                                    promptOptions.Retry,
                                                                    attempts: promptOptions.Attempts,
                                                                    choices: promptOptions.Choices.ToDictionary(x => x.Key,
                                                                                                                x => (IReadOnlyList <T>)x.Value.ToList().AsReadOnly()),
                                                                    promptStyler: new AdaptivePromptStyler(promptStyle, isAdaptiveCard),
                                                                    descriptions: promptOptions.Descriptions?.ToList());
            }
            PromptDialog.Choice(context, resume, adPromptOptions, recognizeChoices, recognizeNumbers, recognizeOrdinals, minScore);
        }
        // Confirm
        public static void Confirm(IDialogContext context, ResumeAfter <bool> resume, IPromptOptions <string> promptOptions, bool isAdaptiveCard = true, PromptStyle promptStyle = PromptStyle.Auto, string[][] patterns = null)
        {
            var adPromptOptions = new PromptOptions <string>(promptOptions.Prompt,
                                                             promptOptions.Retry,
                                                             attempts: promptOptions.Attempts,
                                                             options: promptOptions.Options ?? PromptDialog.PromptConfirm.Options,
                                                             promptStyler: new AdaptivePromptStyler(promptStyle, isAdaptiveCard));

            PromptDialog.Confirm(context, resume, adPromptOptions, patterns);
        }