C# 在FormFlows-Bot框架中为Quit添加另一个关键字

C# 在FormFlows-Bot框架中为Quit添加另一个关键字,c#,bots,botframework,chatbot,C#,Bots,Botframework,Chatbot,是否可以使用Bot框架在FormDialog中更改Quit命令的关键字 我想在键入某个单词时抛出FormCanceledException(不使用英语作为语言) 如果我可以更改关键字,或者添加另一个与退出相同的关键字,那将是完美的是的,这是可能的。一种方法是在FormCommand.Quit命令中添加一个新术语 您将找到一个正是这样做的示例(下面的代码供您参考) private静态IFormBuilder CreateCustomForm() T:在哪里上课 { var form=new For

是否可以使用Bot框架在FormDialog中更改Quit命令的关键字

我想在键入某个单词时抛出FormCanceledException(不使用英语作为语言)


如果我可以更改关键字,或者添加另一个与退出相同的关键字,那将是完美的

是的,这是可能的。一种方法是在
FormCommand.Quit
命令中添加一个新术语

您将找到一个正是这样做的示例(下面的代码供您参考)

private静态IFormBuilder CreateCustomForm()
T:在哪里上课
{
var form=new FormBuilder();
var command=form.Configuration.Commands[FormCommand.Quit];
var terms=command.terms.ToList();
条款。添加(“取消”);
command.Terms=Terms.ToArray();
var templateAttribute=form.Configuration.Template(TemplateUsage.notUnderstanding);
var patterns=templateAttribute.patterns;
模式[0]+=“键入*取消*退出,或者键入*帮助*(如果需要更多信息)。”;
templateAttribute.Patterns=模式;
申报表;
}
private static IFormBuilder<T> CreateCustomForm<T>()
   where T : class
{
    var form = new FormBuilder<T>();
    var command = form.Configuration.Commands[FormCommand.Quit];
    var terms = command.Terms.ToList();
    terms.Add("cancel");
    command.Terms = terms.ToArray();

    var templateAttribute = form.Configuration.Template(TemplateUsage.NotUnderstood);
    var patterns = templateAttribute.Patterns;
    patterns[0] += " Type *cancel* to quit or *help* if you want more information.";
    templateAttribute.Patterns = patterns;

    return form;
}