我的项目中有4个对话框,第一个是
RootDialog
有一些枚举 . 这是我的根对话框,所以如果用户选择第一个选项,那么我想将他发送到
CreateContact
我在下面添加的对话框,如果用户选择
GetContact
要么
SendMail
然后我会将他发送到相应的Dialog,但我无法在完成或选择第一个Dialog时调用另一个表单对话框 .
[Serializable]
public enum RootOptions
{
CreateContact = 1, GetContact = 2, SendMail
};
[Serializable]
public class RootForm
{
public RootOptions? Option;
public static IForm BuildForm()
{
return new FormBuilder()
.Message("Welcome to TEST BOT!")
.OnCompletion(async (context, rootoption) =>
{
switch(rootoption.Option.Value.ToString()) "")
{
case "CreateContact":
//How to call Contact Dialog
break;
case "GetContact":
//Call Get Contact Dialog
break;
case "SendMail":
//Call Send Mail Dialog
break;
}
})
.Build();
}
}
创建联系人对话框
[Serializable]
public class ContactForm
{
[Prompt("What is the name? {||}")]
public string Name;
[Prompt("What is the Mobile No? {||}")]
public string Mobile;
[Prompt("What is the Email? {||}")]
public string Email;
public static IForm BuildForm()
{
return new FormBuilder()
.Message("Let's create a contact")
.OnCompletion(async (context, profileForm) =>
{
await context.PostAsync("Your contact has been created.");
})
.Build();
}
}
发送邮件对话框
[Serializable]
public class MailForm
{
[Prompt("What is the Email Id? {||}")]
public string Email;
[Prompt("What is the Subject? {||}")]
public string subject;
[Prompt("What is the Message? {||}")]
public string Message;
public static IForm BuildForm()
{
return new FormBuilder()
.Message("Let's Send a Mail")
.OnCompletion(async (context, mailForm) =>
{
await context.PostAsync("Mail Sent.");
})
.Build();
}
}