示例#1
0
        protected async Task <Activity> BuildBingReply(string text)
        {
            dynamic res = await BingSearch.CallBingSearch(text);

            Activity replyToConversation = msg.CreateReply();

            replyToConversation.Type        = "message";
            replyToConversation.Attachments = new List <Attachment>();
            List <CardAction> cardButtons = new List <CardAction>();
            CardAction        plButton    = new CardAction()
            {
                Value = res.displayUrl,
                Type  = "openUrl",
                Title = text
            };

            cardButtons.Add(plButton);
            ThumbnailCard plCard = new ThumbnailCard()
            {
                Title    = res.name,
                Subtitle = res.snippet,
                //Images = cardImages,
                Buttons = cardButtons
            };
            Attachment plAttachment = plCard.ToAttachment();

            replyToConversation.Attachments.Add(plAttachment);
            return(replyToConversation);
        }