Lingua

MessageFactory.Carousel Metodo

Definizione

Restituisce un'attività di messaggio che contiene una raccolta di allegati, come carosella.

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

Parametri

attachments
IEnumerable<Attachment>

Gli allegati da includere nel messaggio.

text
String

Facoltativo, il testo del messaggio da inviare.

ssml
String

Facoltativo, testo da pronunciare dal bot in un canale abilitato per il riconoscimento vocale.

inputHint
String

Facoltativo, indica se il bot accetta, prevede o ignora l'input dell'utente dopo che il messaggio viene recapitato al client. Uno di: "accettaInput", "ignoringInput" o "expectingInput". Il valore predefinito è "accettaInput".

Valori restituiti

Attività di messaggio contenente l'allegato.

Eccezioni

attachments è null.

Esempio

Questo codice crea e invia una giostra di 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);

Si applica a

Vedi anche