Freigeben über


MessageFactory.Carousel Methode

Definition

Gibt eine Nachrichtenaktivität zurück, die eine Auflistung von Anlagen als Karussell enthält.

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

Parameter

attachments
IEnumerable<Attachment>

Die Anlagen, die in die Nachricht aufgenommen werden sollen.

text
String

Optional: der Text der zu sendenden Nachricht.

ssml
String

Optional: Text, der von Ihrem Bot in einem sprachfähigen Kanal gesprochen werden soll.

inputHint
String

Optional gibt an, ob Ihr Bot Benutzereingaben akzeptiert, erwartet oder ignoriert, nachdem die Nachricht an den Client übermittelt wurde. Einer von: "acceptingInput", "ignoringInput" oder "expectingInput". Der Standardwert ist "acceptingInput".

Gibt zurück

Eine Nachrichtenaktivität, die die Anlage enthält.

Ausnahmen

attachments ist null.

Beispiele

Dieser Code erstellt und sendet ein Karussell von 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);

Gilt für:

Weitere Informationen