I have created a formflow in botframework. I want to change the confirmation options, by default it takes 'Yes' and 'No'. but i want it to proceed instead 'Yes', even if user inputs 'OK', 'Ya', 'Yeah' etc. how i can add options for confirmation
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You need to add the new terms to the Yes
array of the FormBuilder configuration. Something like:
public static IFormBuilder<T> CreateCustomForm<T>()
where T : class
{
var form = new FormBuilder<T>();
var yesTerms = form.Configuration.Yes.ToList();
yesTerms.Add("Ya");
form.Configuration.Yes = yesTerms.ToArray();
return form;
}
That then you can use like:
return CreateCustomForm<MyForm>()
The reason of this would be something like the following:
The Confirmation field, set it's type to bool. At some point, a recognizer is defined for the field, based on it's type. In this, case, the Confirmation
field will use the RecognizeBool recognizer.
The recognizer uses the Yes/No arrays defined in the form's configuration (which initially they are retrieved from the resource file) for doing the parsing.
When the Confirmation
field is added to the Form, a ConfirmStep step is also added. The ConfirmStep is the one that later in the game ends up calling the recognizer to do the matching and parsing of the terms.