2016-11-22 52 views

回答

7

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

Here你会发现

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; 
} 
+0

它的工作是(以下和代码,供大家参考)做的正是这样的例子!很多! –

相关问题