コード例 #1
0
        private static PromptChoice <IssueDataModel> PromptSimpleDialog2(IDialogContext context, PromptOptions <IssueDataModel> options)
        {
            var child = new PromptChoice <IssueDataModel>(_options);

            //context.Call<IssueDataModel>(child, OnOperationSelected);
            return(child);
        }
コード例 #2
0
#pragma warning restore 1998

        public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            IMessageActivity messageActivity = await result;
            string           message         = messageActivity.Text;

            if (!string.IsNullOrEmpty(message))
            {
                if (message.ToLower().Contains("help"))
                {
                    await MessageRouterManager.Instance.InitiateEngagementAsync((messageActivity as Activity));

                    context.Done(this);
                }
                else if (message.ToLower().Contains("hal"))
                {
                    await context.PostAsync("Bonjour je m'appelle HAL et je suis à votre service");

                    var listDemandes = new List <DemandeModel>();
                    listDemandes.Add(new DemandeModel {
                        Title = "Problème logiciel", Demande = DEMANDTYPE.SOFTWARE_DEMAND
                    });
                    listDemandes.Add(new DemandeModel {
                        Title = "Problème de facturation", Demande = DEMANDTYPE.BILLING_ISSUE
                    });
                    listDemandes.Add(new DemandeModel {
                        Title = "Expertise comptable", Demande = DEMANDTYPE.ACCOUNTABILITY_EXPERT
                    });

                    var promptOptions = new PromptOptions <DemandeModel>("Votre demande concerne :",
                                                                         "Cette option n'est pas valide", "trop d'essais",
                                                                         listDemandes,
                                                                         3,
                                                                         new PromptStyler(PromptStyle.Auto));

                    var child = new PromptChoice <DemandeModel>(promptOptions);
                    context.Call <DemandeModel>(child, OnOperationSelected);
                }
                else
                {
                    messageActivity      = context.MakeMessage();
                    messageActivity.Text = $"" + message;
                    await context.PostAsync(messageActivity);

                    context.Done(this);
                }
            }
        }
コード例 #3
0
ファイル: PromptDialog.cs プロジェクト: domsteil/BotBuilder
        /// <summary>
        /// Prompt for one of a set of choices.
        /// </summary>
        /// <remarks><typeparamref name="T"/> should implement <see cref="object.ToString"/></remarks>
        /// <typeparam name="T"> The type of the options.</typeparam>
        /// <param name="context"> The dialog context.</param>
        /// <param name="resume"> Resume handler.</param>
        /// <param name="promptOptions"> The prompt options.</param>
        public static void Choice <T>(IDialogContext context, ResumeAfter <T> resume, PromptOptions <T> promptOptions)
        {
            var child = new PromptChoice <T>(promptOptions);

            context.Call <T>(child, resume);
        }
コード例 #4
0
        private static void PromptSimpleDialog(IDialogContext context)
        {
            var child = new PromptChoice <IssueDataModel>(_options);

            context.Call <IssueDataModel>(child, OnOperationSelected);
        }
コード例 #5
0
 /// <summary>   Prompt for one of a set of choices. </summary>
 /// <param name="context">  The context. </param>
 /// <param name="resume">   Resume handler. </param>
 /// <param name="options">  The possible options all of which must be convertible to a string.</param>
 /// <param name="prompt">   The prompt to show to the user. </param>
 /// <param name="retry">    What to show on retry. </param>
 /// <param name="attempts"> The number of times to retry. </param>
 public static void Choice<T>(IDialogContext context, ResumeAfter<T> resume, IEnumerable<T> options, string prompt, string retry = null, int attempts = 3)
 {
     var child = new PromptChoice<T>(options, prompt, retry, attempts);
     context.Call<T>(child, resume);
 }