当用户在一段时间后没有回答时,我想停止我的表单流。
public IForm<PatientForm> BuildForm()
{
if (dateFirstAnswer.AddSeconds(30) < DateTime.Now)
return null;
else
{
return new FormBuilder<PatientForm>()
.Message(ResourceStringExtentionsPatientForm.IntroForm.Spintax())
.OnCompletion(async (context, profileForm) =>
{
string message = ResourceStringExtentionsPatientForm.OutroForm.Spintax();
await context.PostAsync(message);
})
.Build();
}
}我试图返回null,但在离开表单流之后,我无法管理任何东西。
Return new FormBuilder<PatientForm>().Build()只跳过1个问题,表单流继续。
有没有办法可以像用户一样调用FormCommand.Quit?
第二个问题,我看到了一些BuildForm()是静态的例子,有什么理由这样做吗?
发布于 2017-03-15 20:31:54
你应该试试这个:
IForm<PatientForm> newForm;
public void BuildForm()
{
if (dateFirstAnswer.AddSeconds(30) > DateTime.Now)
{
newForm = new FormBuilder<PatientForm>()
.Message(ResourceStringExtentionsPatientForm.IntroForm.Spintax())
.OnCompletion(async (context, profileForm) =>
{
string message = ResourceStringExtentionsPatientForm.OutroForm.Spintax();
await context.PostAsync(message);
})
.Build();
}
}https://stackoverflow.com/questions/42809608
复制相似问题