Articles → MICROSOFT BOT FRAMEWORK → Formflow In Microsoft Bot Framework
Formflow In Microsoft Bot Framework
Purpose
Example
- Name
- Age
- Marital Status
- Create a new class "FormFlowDemo".
- Write the following code.
using Microsoft.Bot.Builder.FormFlow;
using System;
namespace Bot_Application1.Dialogs {
public enum MaritalStatus {
Married,
Unmarried,
Single
}
[Serializable]
public class FormFlowDemo {
public string name;
public int age;
public MaritalStatus ? maritalStatus;
public static IForm < FormFlowDemo > GetForm() {
return new FormBuilder < FormFlowDemo > ().Message("Welcome to support chat system. Please enter the following information to serve you better").Build();
}
}
}
- Inside the "MessagesController.cs", create a function "MakeDialog".
private IDialog < Dialogs.FormFlowDemo > MakeDialog() {
return Chain.From(() = >FormDialog.FromForm(Dialogs.FormFlowDemo.GetForm));
}
- Call the "MakeDialog" method inside the "Post" method.
Click to Enlarge
Output
Click to Enlarge
Click to Enlarge
Click to Enlarge
Status And Help
Click to Enlarge
Click to Enlarge