共用方式為


MessageFactory.Carousel 方法

定義

傳回訊息活動,其中包含附件集合,做為浮動切換。

public static Microsoft.Bot.Schema.IMessageActivity Carousel (System.Collections.Generic.IEnumerable<Microsoft.Bot.Schema.Attachment> attachments, string text = default, string ssml = default, string inputHint = default);
static member Carousel : seq<Microsoft.Bot.Schema.Attachment> * string * string * string -> Microsoft.Bot.Schema.IMessageActivity
Public Shared Function Carousel (attachments As IEnumerable(Of Attachment), Optional text As String = Nothing, Optional ssml As String = Nothing, Optional inputHint As String = Nothing) As IMessageActivity

參數

attachments
IEnumerable<Attachment>

要包含在郵件中的附件。

text
String

選擇性,要傳送之訊息的文字。

ssml
String

在已啟用語音功能的通道上,Bot 所要說出的文字是選擇性的。

inputHint
String

選擇性,指出您的 Bot 在訊息傳遞至用戶端之後是否接受、預期或忽略使用者輸入。 其中一個:「acceptingInput」、「ignoringInput」 或 「expectingInput」。 預設值為 「acceptingInput」。

傳回

包含附件的郵件活動。

例外狀況

attachmentsnull

範例

此程式碼會建立並傳送 HeroCards 的浮動切換。

// Create the activity and attach a set of Hero cards.
var activity = MessageFactory.Carousel(
new Attachment[]
{
    new HeroCard(
        title: "title1",
        images: new CardImage[] { new CardImage(url: "imageUrl1.png") },
        buttons: new CardAction[]
        {
            new CardAction(title: "button1", type: ActionTypes.ImBack, value: "item1")
        })
    .ToAttachment(),
    new HeroCard(
        title: "title2",
        images: new CardImage[] { new CardImage(url: "imageUrl2.png") },
        buttons: new CardAction[]
        {
            new CardAction(title: "button2", type: ActionTypes.ImBack, value: "item2")
        })
    .ToAttachment(),
    new HeroCard(
        title: "title3",
        images: new CardImage[] { new CardImage(url: "imageUrl3.png") },
        buttons: new CardAction[]
        {
            new CardAction(title: "button3", type: ActionTypes.ImBack, value: "item3")
        })
    .ToAttachment()
});

// Send the activity as a reply to the user.
await context.SendActivity(activity);

適用於

另請參閱