保存由於缺乏教程和信息我無法找到我怎麼能保存在機器人的信息。比方說,我要求用戶做出這樣的選擇:Botframework如何selction
public enum City
{
Cleveland, Columbus, Kentucky, Mason, Akron
};
[Serializable]
public class SandwichOrder
{
[Prompt("Please select what {&} you are in? {||}")]
public City? City;
public static IForm<SandwichOrder> BuildForm()
{
return new FormBuilder<SandwichOrder>()
.Message("Welcome to the my bot!")
.Build();
}
};
我只想問一次城市我該怎麼做?我如何保留用戶選擇的價值,並且只在第一次用戶交互時才調用此方法。
Controller類:
internal static IDialog<SandwichOrder> MakeRootDialog()
{
return Chain.From(() => FormDialog.FromForm(SandwichOrder.BuildForm));
}
[ResponseType(typeof(void))]
public virtual async Task<HttpResponseMessage> Post([FromBody] Activity activity)
{
if (activity != null)
{
// one of these will have an interface and process it
switch (activity.GetActivityType())
{
case ActivityTypes.Message:
await Conversation.SendAsync(activity, MakeRootDialog);
break;
}
}
var response = Request.CreateResponse(HttpStatusCode.OK);
return response;
}