2017-03-15 3 views
0

일정 시간이 지나면 사용자가 응답하지 않을 때 양식 흐름을 멈추고 싶습니다.FormFlow : 몇 시간 후에 양식 취소

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을 반환하려했으나 formflow를 종료 한 후에 아무 것도 관리 할 수 ​​없습니다.

돌아 가기 new FormBuilder<PatientForm>().Build() 만 건너 뛰면 양식 흐름이 계속됩니다.

사용자가 할 수있는 것처럼 FormCommand.Quit를 호출 할 수있는 방법이 있습니까?

두 번째 질문은 BuildForm()이 정적 인 예제를 보았습니다. 그 이유는 무엇입니까?

답변

0

당신이 시도해야합니다

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(); 
      } 
     } 
+0

내가의 인스턴스를 만들 수 없습니다 '는 인터페이스의 IForm'. 그리고 내 주요 문제는 내가 formflow를 종료하고 내가 사용할 수있는 무언가를 반환해야한다는 것입니다. – Deviss

+0

그렇다면 반드시 빈 IForm을 반환해야합니다. –

+0

나는 인터페이스가 아니다. – Deviss

관련 문제