/// <summary> /// Generate ToAdaptiveCardAttachmentWithoutSpeech. /// </summary> /// <param name="todos">To Do activities.</param> /// <param name="allTaskCount">all tasks count.</param> /// <param name="taskContent">the task content.</param> /// <param name="botResponse1">the bot response 1.</param> /// <param name="botResponse2">the bot response 2.</param> /// <returns>Generated adaptive card attachment.</returns> public static Microsoft.Bot.Schema.Attachment ToAdaptiveCardAttachmentForOtherFlows( List <ToDoTaskActivityModel> todos, int allTaskCount, string taskContent, BotResponse botResponse1, BotResponse botResponse2) { var toDoCard = new AdaptiveCard(); var showText = Format(botResponse2.Reply.Text, new StringDictionary() { { "taskCount", allTaskCount.ToString() } }); var speakText = Format(botResponse1.Reply.Speak, new StringDictionary() { { "taskContent", taskContent } }) + Format(botResponse2.Reply.Speak, new StringDictionary() { { "taskCount", allTaskCount.ToString() } }); toDoCard.Speak = speakText; var body = new List <AdaptiveElement>(); var textBlock = new AdaptiveTextBlock { Text = showText, }; body.Add(textBlock); var choiceSet = new AdaptiveChoiceSetInput(); choiceSet.IsMultiSelect = true; string value = Guid.NewGuid().ToString() + ","; foreach (var todo in todos) { var choice = new AdaptiveChoice(); choice.Title = todo.Topic; choice.Value = todo.Id; choiceSet.Choices.Add(choice); if (todo.IsCompleted) { value += todo.Id + ","; } } value = value.Remove(value.Length - 1); choiceSet.Value = value; body.Add(choiceSet); toDoCard.Body = body; var attachment = new Microsoft.Bot.Schema.Attachment() { ContentType = AdaptiveCard.ContentType, Content = toDoCard, }; return(attachment); }
public async Task SendConversation(IConfiguration configuration) { Microsoft.Bot.Schema.Attachment card = CardHelper.CreateAdaptiveCardAttachment(Constants.UserCard, configuration); await Common.SendChannelData(card, configuration); }