Change Confirm options in botframework Formflow

感情迁移 提交于 2019-12-10 17:28:50

问题


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.



来源:https://stackoverflow.com/questions/42947804/change-confirm-options-in-botframework-formflow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!