Beispiel #1
0
        // Initial message is processed by this method
        async Task MessageReceivedAsync(
            IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var activity = await result;

            string messagePrompt = "What would you like to do?";
            string messageRetry  = "I don't know about that option, please select an option in the list";



            // Check for the message text. If it's a catalog then execute the dialog sequence
            // for this message handling
            if (activity.Text.Contains("transaction"))
            {
                List <string> transactionsList = TransactionType.CreateTransactionsList();


                var promptOptions =
                    new PromptOptions <string>(
                        prompt: messagePrompt,
                        retry: messageRetry,
                        options: transactionsList,
                        speak: messagePrompt,
                        retrySpeak: messageRetry);

                PromptDialog.Choice(
                    context: context,
                    resume: TransactionTypeReceivedAsync,
                    promptOptions: promptOptions);

                //PromptDialog.Choice(
                //   context: context,
                //   resume: TransactionTypeReceivedAsync,
                //   options: transactionsList,
                //   prompt: "Which type of transaction to perform?",
                //   retry: "Please select a valid transaction type: ",
                //   attempts: 4,
                //   promptStyle: PromptStyle.PerLine);
            }
            else
            {
                await context.PostAsync(
                    "Currently, the only thing I can do is to perform a transaction. " +
                    "Type \"transaction\" if you would like to do that");
            }
        }