public async Task StartAsync(IDialogContext context)
        {
            var result = await this.SearchClient.SearchAsync(this.QueryBuilder, this.Refiner);

            IEnumerable <string> options = result.Facets[this.Refiner].Select(f => this.FormatRefinerOption((string)f.Value, f.Count));

            var promptOptions = new CancelablePromptOptions <string>(this.Prompt, cancelPrompt: "Type 'cancel' if you don't want to select any of these.", options: options.ToList(), promptStyler: this.PromptStyler);

            CancelablePromptChoice <string> .Choice(context, this.ApplyRefiner, promptOptions);
        }
        public async Task StartAsync(IDialogContext context)
        {
            IEnumerable <string> unusedRefiners = this.Refiners;

            if (this.QueryBuilder != null)
            {
                unusedRefiners = unusedRefiners.Except(this.QueryBuilder.Refinements.Keys, StringComparer.OrdinalIgnoreCase);
            }

            if (unusedRefiners.Any())
            {
                var promptOptions = new CancelablePromptOptions <string>("What do you want to refine by?", cancelPrompt: "Type 'cancel' if you changed your mind.", options: unusedRefiners.ToList(), promptStyler: this.PromptStyler);
                CancelablePromptChoice <string> .Choice(context, this.ReturnSelection, promptOptions);
            }
            else
            {
                await context.PostAsync("Oops! You used all the available refiners and you cannot refine the results anymore.");

                context.Done <string>(null);
            }
        }
        public static void Choice(IDialogContext context, ResumeAfter <T> resume, CancelablePromptOptions <T> promptOptions)
        {
            var child = new CancelablePromptChoice <T>(promptOptions);

            context.Call(child, resume);
        }
 public CancelablePromptChoice(CancelablePromptOptions <T> promptOptions)
     : base(promptOptions)
 {
     this.PromptOptions = promptOptions;
 }