3
特定の医者が持っているセッションをヒーローカードに表示してボットに送信します。私はreplyToConversation.Attachments = GetSessionHeroCard()を行うとここボットフレームワークの添付ファイルにヒーローカードのリストを送信
はコード
private async Task ShowSessionsHeroCard(IDialogContext context)
{
var replyToConversation = context.MakeMessage();
replyToConversation.AttachmentLayout = AttachmentLayoutTypes.Carousel;
replyToConversation.Attachments = GetSessionHeroCard();
await context.PostAsync(replyToConversation);
}
private Attachment GetSessionHeroCard()
{
var heroCard = new HeroCard();
foreach (var sessionDetails in scheduleList)
{
string[] session = GetSplittedDetails(sessionDetails);
string hospitalName = session[0]; //Hospital Name: {0}
string availableDay = session[1]; //Available Day: {1}
string appointmentNo = session[2]; // Appoinment No: {2}
string sessionAvailable = session[3]; // Session: {3}
heroCard.Title = hospitalName;
heroCard.Subtitle = availableDay;
heroCard.Text = sessionAvailable + appointmentNo;
}
return heroCard.ToAttachment();
}
private string[] GetSplittedDetails(string sessionDetails)
{
return sessionDetails.Split(',');
}
です。
私はこれで私を助けてください、次のエラー
Cannot implicitly convert type 'Microsoft.Bot.Connector.Attachment' to 'System.Collections.Generic.List<Microsoft.Bot.Connector.Attachment>'
を取得します。時間のために苦労しています。ありがとうございます。
おかげで、これはそれを解決しました。 :) – Azmy