Share via


IFormBuilder<T> Interface

Definition

Interface for building a form.

public interface IFormBuilder<T> where T : class
type IFormBuilder<'T (requires 'T : null)> = interface
Public Interface IFormBuilder(Of T)

Type Parameters

T

Form state.

Derived

Remarks

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

By default the steps are executed in the order of the Message(String, ActiveDelegate<T>, IEnumerable<String>), Field(IField<T>) and Confirm(String, ActiveDelegate<T>, IEnumerable<String>) 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.

Properties

Configuration

The form configuration supplies default templates and settings.

Methods

AddRemainingFields(IEnumerable<String>)

Add all fields not already added to the form.

Build(Assembly, String)

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

Confirm(MessageDelegate<T>, ActiveDelegate<T>, IEnumerable<String>)

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

Confirm(PromptAttribute, ActiveDelegate<T>, IEnumerable<String>)

Add a confirmation step.

Confirm(String, ActiveDelegate<T>, IEnumerable<String>)

Add a confirmation step.

Field(IField<T>)

Derfine a field step by supplying your own field definition.

Field(String, ActiveDelegate<T>, ValidateAsyncDelegate<T>)

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

Field(String, PromptAttribute, ActiveDelegate<T>, ValidateAsyncDelegate<T>)

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

Field(String, String, ActiveDelegate<T>, ValidateAsyncDelegate<T>)

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

HasField(String)

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

Message(MessageDelegate<T>, ActiveDelegate<T>, IEnumerable<String>)

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

Message(PromptAttribute, ActiveDelegate<T>, IEnumerable<String>)

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

Message(String, ActiveDelegate<T>, IEnumerable<String>)

Show a message that does not require a response.

OnCompletion(OnCompletionAsyncDelegate<T>)

Delegate to call when form is completed.

Prompter(PromptAsyncDelegate<T>)

Delegate to send prompt to user.

Applies to