1
봇 프레임 워크 나 아래의 요구 사항을 충족 할 수있는 다른 시나리오에서 카드 버튼을 비활성화 할 수 있는지 알려주십시오.봇 프레임 워크에서 버튼을 한번 클릭 한 후 닫는 방법
아래 코드는 Bot Framework
및 LUIS
에서 실행하려고 시도한 코드입니다.
[LuisIntent("OrderStatus")]
public async Task Status(IDialogContext context, IAwaitable<IMessageActivity> activity, LuisResult result)
{
var message = await activity;
List<CardAction> cardButtons = new List<CardAction>();
CardAction cityBtn1 = new CardAction()
{
Title = "Laptop",
Value = "Laptop"
};
cardButtons.Add(cityBtn1);
CardAction cityBtn2 = new CardAction()
{
Title = "Smart Phone",
Value = "Smart Phone",
};
cardButtons.Add(cityBtn2);
CardAction cityBtn3 = new CardAction()
{
Title = "Pendrive",
Value = "Pendrive"
};
cardButtons.Add(cityBtn3);
CardAction cityBtn4 = new CardAction()
{
Title = "No option",
Value = "No option"
};
cardButtons.Add(cityBtn4);
var reply = context.MakeMessage();
HeroCard plCard = new HeroCard()
{
Title = "Please select from the following option?",
Buttons = cardButtons
};
Attachment plAttachment = plCard.ToAttachment();
reply.Attachments.Add(plCard.ToAttachment());
await context.PostAsync(reply);
context.Wait(MessageReceivedAsync);
}
private const string Yes = "Yes";
private const string No = "No";
private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<object> awaitresult)
{
var selectedCard = await awaitresult as Activity;
string result = string.Empty;
var selectedText = selectedCard.Text;
if (selectedText.ToLower() == "Laptop".ToLower())
{
result = "Your laptop will be delivered by the end of this week";
}
else if (selectedText.ToLower() == "high water content".ToLower())
{
result = "Your smart phone will be delivered by the end of this week";
}
else if (selectedText.ToLower() == "Incompatible fuel or high water content".ToLower())
{
result = "Your pendrive will be delivered by the end of this week";
}
else if (selectedText.ToLower() == "No option".ToLower())
{
result = "Please visit our official website for more options";
}
await context.PostAsync(result);
PromptDialog.Choice(context, this.AfterMenuSelection, new List<string>() { Yes, No }, "Do you have any other issue?");
}
private async Task AfterMenuSelection(IDialogContext context, IAwaitable<string> result)
{
var optionSelected = await result;
switch (optionSelected)
{
case Yes:
await context.PostAsync("Please post your issue");
break;
case No:
await context.PostAsync("Thanks for contacting us");
break;
}
context.EndConversation("End");
}
사용자가 하나의 버튼을 클릭하면 두 번째 버튼을 클릭 할 수 없습니다.
이 문제로 도와주세요.