Compartir a través de


MessageFactory.Carousel Método

Definición

Devuelve una actividad de mensaje que contiene una colección de datos adjuntos, como carrusel.

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

Parámetros

attachments
IEnumerable<Attachment>

Los datos adjuntos que se van a incluir en el mensaje.

text
String

Opcional, el texto del mensaje que se va a enviar.

ssml
String

Opcional, el bot dirá texto en un canal habilitado para voz.

inputHint
String

Opcional, indica si el bot acepta, espera o ignora la entrada del usuario después de entregar el mensaje al cliente. Uno de: "acceptingInput", "ignoreingInput" o "expectingInput". El valor predeterminado es "acceptingInput".

Devoluciones

Actividad de mensaje que contiene los datos adjuntos.

Excepciones

attachments es null.

Ejemplos

Este código crea y envía un carrusel de 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);

Se aplica a

Consulte también