Microsoft.Bot.Builder.FormFlow.IFormBuilder< T > Interface Template Reference

Interface for building a form. More...

Inheritance diagram for Microsoft.Bot.Builder.FormFlow.IFormBuilder< T >:

Public Member Functions

IFormBuilder< T > AddRemainingFields (IEnumerable< string > exclude=null)
 Add all fields not already added to the form. More...
 
IForm< T > Build (Assembly resourceAssembly=null, string resourceName=null)
 Build the form based on the methods called on the builder. More...
 
IFormBuilder< T > Confirm (string prompt=null, ActiveDelegate< T > condition=null, IEnumerable< string > dependencies=null)
 Add a confirmation step. More...
 
IFormBuilder< T > Confirm (PromptAttribute prompt, ActiveDelegate< T > condition=null, IEnumerable< string > dependencies=null)
 Add a confirmation step. More...
 
IFormBuilder< T > Confirm (MessageDelegate< T > generateMessage, ActiveDelegate< T > condition=null, IEnumerable< string > dependencies=null)
 Generate a confirmation using a delegate to dynamically build the message. More...
 
IFormBuilder< T > Field (IField< T > field)
 Derfine a field step by supplying your own field definition. More...
 
IFormBuilder< T > Field (string name, ActiveDelegate< T > active=null, ValidateAsyncDelegate< T > validate=null)
 Define a step for filling in a particular value in the form state. More...
 
IFormBuilder< T > Field (string name, string prompt, ActiveDelegate< T > active=null, ValidateAsyncDelegate< T > validate=null)
 Define a step for filling in a particular value in the form state. More...
 
IFormBuilder< T > Field (string name, PromptAttribute prompt, ActiveDelegate< T > active=null, ValidateAsyncDelegate< T > validate=null)
 Define a step for filling in a particular value in the form state. More...
 
bool HasField (string name)
 Test to see if there is already a field with name . More...
 
IFormBuilder< T > Message (string message, ActiveDelegate< T > condition=null, IEnumerable< string > dependencies=null)
 Show a message that does not require a response. More...
 
IFormBuilder< T > Message (PromptAttribute prompt, ActiveDelegate< T > condition=null, IEnumerable< string > dependencies=null)
 Show a message with more format control that does not require a response. More...
 
IFormBuilder< T > Message (MessageDelegate< T > generateMessage, ActiveDelegate< T > condition=null, IEnumerable< string > dependencies=null)
 Generate a message using a delegate to dynamically build the message. More...
 
IFormBuilder< T > OnCompletion (OnCompletionAsyncDelegate< T > callback)
 Delegate to call when form is completed. More...
 
IFormBuilder< T > Prompter (PromptAsyncDelegate< T > prompter)
 Delegate to send prompt to user. More...
 

Properties

FormConfiguration Configuration [get]
 The form configuration supplies default templates and settings. More...
 

Detailed Description

Interface for building a form.

A form consists of a series of steps that can be one of:

  • A message to the user.
  • A prompt sent to the user where the response is to fill in a form state value.
  • A confirmation of the current state with the user.

By default the steps are executed in the order of the Message, Field and Confirm calls. If you do not take explicit control, the steps will be executed in the order defined in the form state with a final confirmation. This interface allows you to flently build a form by composing together fields, messages and confirmation. The fluent building blocks provide common patterns like fields being based on your state class, but you can also build up your own definition of a form by using Advanced.IField. If you want to build a form using C# reflection over your state class use FormBuilder. To declaratively build a form through JSON Schema you can use Json.FormBuilderJson.

Forms are sensitive to the current thread UI culture. The Microsoft.Bot.Builder strings will localize to that culture if available. You can also localize the strings generated for your form by calling IForm.SaveResources or by using the RView tool and adding that resource to your project. For strings in dynamic fields, messages or confirmations you will need to use the normal C# mechanisms to localize them. Look in the overview documentation for more information.

Template Parameters
TForm state.
Type Constraints
T :class 

Definition at line 77 of file IFormBuilder.cs.

Member Function Documentation

IFormBuilder<T> Microsoft.Bot.Builder.FormFlow.IFormBuilder< T >.AddRemainingFields ( IEnumerable< string >  exclude = null)

Add all fields not already added to the form.

Parameters
excludeFields not to include.
Returns
Modified IFormBuilder.

This will add all fields defined in your form that have not already been added if the fields are supported.

Implemented in Microsoft.Bot.Builder.FormFlow.FormBuilder< T >, and Microsoft.Bot.Builder.FormFlow.FormBuilderBase< T >.

IForm<T> Microsoft.Bot.Builder.FormFlow.IFormBuilder< T >.Build ( Assembly  resourceAssembly = null,
string  resourceName = null 
)

Build the form based on the methods called on the builder.

Parameters
resourceAssemblyAssembly for localization resources.
resourceNameName of resources to use for localization.
Returns
The constructed form.

The default assembly is the one that contains T and the default resourceName if the name of that type.

Implemented in Microsoft.Bot.Builder.FormFlow.FormBuilder< T >, and Microsoft.Bot.Builder.FormFlow.FormBuilderBase< T >.

IFormBuilder<T> Microsoft.Bot.Builder.FormFlow.IFormBuilder< T >.Confirm ( string  prompt = null,
ActiveDelegate< T >  condition = null,
IEnumerable< string >  dependencies = null 
)

Add a confirmation step.

Parameters
promptPrompt to use for confirmation.
conditionDelegate to test if confirmation applies to the current form state.
dependenciesWhat fields this confirmation depends on.
Returns
Modified IFormBuilder.

If prompt is not supplied the Pattern Language element {*} will be used to confirm. Dependencies will by default be all active steps defined before this confirmation.

Implemented in Microsoft.Bot.Builder.FormFlow.FormBuilderBase< T >.

IFormBuilder<T> Microsoft.Bot.Builder.FormFlow.IFormBuilder< T >.Confirm ( PromptAttribute  prompt,
ActiveDelegate< T >  condition = null,
IEnumerable< string >  dependencies = null 
)

Add a confirmation step.

Parameters
promptPrompt to use for confirmation.
conditionDelegate to test if confirmation applies to the current form state.
dependenciesWhat fields this confirmation depends on.
Returns
Modified IFormBuilder.

Dependencies will by default be all active steps defined before this confirmation.

Implemented in Microsoft.Bot.Builder.FormFlow.FormBuilderBase< T >.

IFormBuilder<T> Microsoft.Bot.Builder.FormFlow.IFormBuilder< T >.Confirm ( MessageDelegate< T >  generateMessage,
ActiveDelegate< T >  condition = null,
IEnumerable< string >  dependencies = null 
)

Generate a confirmation using a delegate to dynamically build the message.

Parameters
generateMessageDelegate for building message.
conditionWhether or not this step is active.
dependenciesWhat fields this confirmation depends on.
Returns
Modified IFormBuilder.

Implemented in Microsoft.Bot.Builder.FormFlow.FormBuilderBase< T >.

Derfine a field step by supplying your own field definition.

Parameters
fieldField definition to use.
Returns
Modified IFormBuilder.

You can provide your own implementation of IField<T> or you can use the Field<T> class to provide fluent values, FieldReflector<T> to use reflection or Json.FieldJson to use JSON Schema.

Implemented in Microsoft.Bot.Builder.FormFlow.FormBuilderBase< T >.

IFormBuilder<T> Microsoft.Bot.Builder.FormFlow.IFormBuilder< T >.Field ( string  name,
ActiveDelegate< T >  active = null,
ValidateAsyncDelegate< T >  validate = null 
)

Define a step for filling in a particular value in the form state.

Parameters
namePath in the form state to the value being filled in.
activeDelegate to test form state to see if step is active.
validateDelegate to validate the field value.
Returns
Modified IFormBuilder.

Implemented in Microsoft.Bot.Builder.FormFlow.FormBuilder< T >, and Microsoft.Bot.Builder.FormFlow.FormBuilderBase< T >.

IFormBuilder<T> Microsoft.Bot.Builder.FormFlow.IFormBuilder< T >.Field ( string  name,
string  prompt,
ActiveDelegate< T >  active = null,
ValidateAsyncDelegate< T >  validate = null 
)

Define a step for filling in a particular value in the form state.

Parameters
namePath in the form state to the value being filled in.
promptSimple Pattern Language to describe prompt for field.
activeDelegate to test form state to see if step is active.n
validateDelegate to validate the field value.
Returns
Modified IFormBuilder.

Implemented in Microsoft.Bot.Builder.FormFlow.FormBuilder< T >, and Microsoft.Bot.Builder.FormFlow.FormBuilderBase< T >.

IFormBuilder<T> Microsoft.Bot.Builder.FormFlow.IFormBuilder< T >.Field ( string  name,
PromptAttribute  prompt,
ActiveDelegate< T >  active = null,
ValidateAsyncDelegate< T >  validate = null 
)

Define a step for filling in a particular value in the form state.

Parameters
namePath in the form state to the value being filled in.
promptPrompt pattern with more formatting control to describe prompt for field.
activeDelegate to test form state to see if step is active.n
validateDelegate to validate the field value.
Returns
Modified IFormBuilder.

Implemented in Microsoft.Bot.Builder.FormFlow.FormBuilder< T >, and Microsoft.Bot.Builder.FormFlow.FormBuilderBase< T >.

bool Microsoft.Bot.Builder.FormFlow.IFormBuilder< T >.HasField ( string  name)

Test to see if there is already a field with name .

Parameters
name
Returns
True if field is already present.

Implemented in Microsoft.Bot.Builder.FormFlow.FormBuilderBase< T >.

IFormBuilder<T> Microsoft.Bot.Builder.FormFlow.IFormBuilder< T >.Message ( string  message,
ActiveDelegate< T >  condition = null,
IEnumerable< string >  dependencies = null 
)

Show a message that does not require a response.

Parameters
messageA Pattern Language string to fill in and send.
conditionWhether or not this step is active.
dependenciesFields message depends on.
Returns
Modified IFormBuilder.

Implemented in Microsoft.Bot.Builder.FormFlow.FormBuilderBase< T >.

IFormBuilder<T> Microsoft.Bot.Builder.FormFlow.IFormBuilder< T >.Message ( PromptAttribute  prompt,
ActiveDelegate< T >  condition = null,
IEnumerable< string >  dependencies = null 
)

Show a message with more format control that does not require a response.

Parameters
promptMessage to fill in and send.
conditionWhether or not this step is active.
dependenciesFields message depends on.
Returns
Modified IFormBuilder.

Implemented in Microsoft.Bot.Builder.FormFlow.FormBuilderBase< T >.

IFormBuilder<T> Microsoft.Bot.Builder.FormFlow.IFormBuilder< T >.Message ( MessageDelegate< T >  generateMessage,
ActiveDelegate< T >  condition = null,
IEnumerable< string >  dependencies = null 
)

Generate a message using a delegate to dynamically build the message.

Parameters
generateMessageDelegate for building message.
conditionWhether or not this step is active.
dependenciesFields message depends on.
Returns
Modified IFormBuilder.

Implemented in Microsoft.Bot.Builder.FormFlow.FormBuilderBase< T >.

IFormBuilder<T> Microsoft.Bot.Builder.FormFlow.IFormBuilder< T >.OnCompletion ( OnCompletionAsyncDelegate< T >  callback)

Delegate to call when form is completed.

Parameters
callbackDelegate to call on completion.
Returns
Modified IFormBuilder.

This should only be used for side effects such as calling your service with the form state results. In any case the completed form state will be passed to the parent dialog.

Implemented in Microsoft.Bot.Builder.FormFlow.FormBuilderBase< T >.

IFormBuilder<T> Microsoft.Bot.Builder.FormFlow.IFormBuilder< T >.Prompter ( PromptAsyncDelegate< T >  prompter)

Delegate to send prompt to user.

Parameters
prompterDelegate.
Returns
Modified IFormBuilder.

Implemented in Microsoft.Bot.Builder.FormFlow.FormBuilderBase< T >.

Property Documentation

The form configuration supplies default templates and settings.

Returns
The current form configuration.

Definition at line 96 of file IFormBuilder.cs.


The documentation for this interface was generated from the following file: