public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options, CancellationToken cancellationToken = default(CancellationToken)) { //var message = Activity.CreateMessageActivity(); //message.Type = ActivityTypes.Message; //message.Attachments = new List<Attachment> { Helper.CreateAdaptiveCardAttachment(new[] { ".", "Dialogs", "Welcome", "Resources", "chooseSizeCard.json" }), EchoBot1Bot.ChooseSizeCard(), }; var drinkSize = dc.Context.Activity.Text; if (drinkSize == "Large" || drinkSize == "Middle" || drinkSize == "Small") { await dc.Context.SendActivityAsync("Sucessfully"); } else if ("Order".Equals(dc.Context.Activity.Text, StringComparison.OrdinalIgnoreCase)) { var message = Activity.CreateMessageActivity(); message.Type = ActivityTypes.Message; message.Attachments = new List <Attachment> { AdaptiveCardFactory.CreateDrinkTypeCard() }; await dc.Context.SendActivityAsync(message); return(await dc.EndDialogAsync()); } else { await dc.Context.SendActivityAsync("Order failed.Please input Order to reorder."); } return(await dc.EndDialogAsync()); }
private async Task SendWelcomeMessageAsync(ITurnContext turnContext) { var activity = turnContext.Activity.CreateReply(); //activity.Attachments = new List<Attachment> { AdaptiveCardFactory.CreateWelcomeCard()}; activity.Attachments = new List <Attachment> { AdaptiveCardFactory.CreateDrinkTypeCard() }; await turnContext.SendActivityAsync(activity); }
public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options, CancellationToken cancellationToken = default(CancellationToken)) { var message = Activity.CreateMessageActivity(); message.Type = ActivityTypes.Message; //message.Attachments = new List<Attachment> { AdaptiveCardFactory.CreateChoiceCard(DrinkType.Tea), AdaptiveCardFactory.CreateChoiceCard(DrinkType.Coffer), AdaptiveCardFactory.CreateChoiceCard(DrinkType.Milk), }; //message.Attachments = new List<Attachment> { Helper.CreateAdaptiveCardAttachment(new[] { ".", "Dialogs", "Welcome", "Resources", "orderFood.json" }) }; //message.Attachments = new List<Attachment> { AdaptiveCardFactory.CreateShowCard() }; if (dc.Context.Activity.Text == "Tea" || dc.Context.Activity.Text == "Coffer" || dc.Context.Activity.Text == "Milk") { DrinkType text = (DrinkType)Enum.Parse(typeof(DrinkType), dc.Context.Activity.Text); message.Attachments = new List <Attachment> { AdaptiveCardFactory.ChooseDrinkSubTypeCard(text) }; await dc.Context.SendActivityAsync(message); return(Dialog.EndOfTurn); } else if ("Order".Equals(dc.Context.Activity.Text, StringComparison.OrdinalIgnoreCase)) { message.Attachments = new List <Attachment> { AdaptiveCardFactory.CreateDrinkTypeCard() }; await dc.Context.SendActivityAsync(message); return(await dc.EndDialogAsync()); } else { await dc.Context.SendActivityAsync($"{dc.Context.Activity.Text} has not support now."); return(await dc.EndDialogAsync()); } // switch (dc.Context.Activity.Text) //{ // case "Tea": // case "Coffer": // case "Milk": // message.Attachments = new List<Attachment> { AdaptiveCardFactory.ChooseDrinkSubTypeCard(text) }; // await dc.Context.SendActivityAsync(message); // break; // default: // await dc.Context.SendActivityAsync($"{dc.Context.Activity.Text} has not support now."); // await dc.EndDialogAsync(); // break; //} ////message.Attachments = new List<Attachment> { AdaptiveCardFactory.ChooseDrinkSubTypeCard(text) }; ////await dc.Context.SendActivityAsync(message); //return Dialog.EndOfTurn; //return await base.BeginDialogAsync(dc, new PromptOptions()); }
//protected override async Task OnPromptAsync(ITurnContext turnContext, IDictionary<string, object> state, PromptOptions options, bool isRetry, CancellationToken cancellationToken = default(CancellationToken)) //{ // var message = Activity.CreateMessageActivity(); // message.Type = ActivityTypes.Message; // message.Attachments = new List<Attachment> { Helper.CreateAdaptiveCardAttachment(new[] { ".", "Dialogs", "Welcome", "Resources", "chooseSizeCard.json" }), EchoBot1Bot.ChooseSizeCard(), }; // await turnContext.SendActivityAsync(message); //} public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options, CancellationToken cancellationToken = default(CancellationToken)) { //DialogTurnResult dialogTurnResult; //var drinkType = await stepContext.Context.GetConversationPropertyAsync<Drink>("Drink"); string drinkType = dc.Context.Activity.Text; var message = Activity.CreateMessageActivity(); message.Type = ActivityTypes.Message; switch (drinkType) { //"红茶", "绿茶", "猫屎咖啡", "黑糖玛奇朵咖啡", "酸奶", "纯牛奶" case "红茶": case "绿茶": case "猫屎咖啡": case "黑糖玛奇朵咖啡": case "酸奶": case "纯牛奶": //message.Attachments = new List<Attachment> { EchoBot1Bot.ChooseSizeCard(), }; message.Attachments = new List <Attachment> { AdaptiveCardFactory.CreateChooseSizeCard(), }; await dc.Context.SendActivityAsync(message); return(EndOfTurn); //break; case "order": case "Order": message.Attachments = new List <Attachment> { AdaptiveCardFactory.CreateDrinkTypeCard() }; await dc.Context.SendActivityAsync(message); return(await dc.EndDialogAsync()); default: await dc.Context.SendActivityAsync($"{dc.Context.Activity.Text} has not support now."); return(await dc.EndDialogAsync()); //break; } //var message = Activity.CreateMessageActivity(); //message.Type = ActivityTypes.Message; ////message.Attachments = new List<Attachment> { EchoBot1Bot.ChooseSizeCard(), }; //message.Attachments = new List<Attachment> { AdaptiveCardFactory.CreateChooseSizeCard(), }; //await dc.Context.SendActivityAsync(message); //return Dialog.EndOfTurn; //return await base.BeginDialogAsync(dc, new PromptOptions()); }