2017-01-02 54 views
0

我有兩個ActiveDelegate(S):如何識別Microsoft Bot框架IForm中的哪個ActiveDelegate爲TRUE?

ActiveDelegate isFormFlow =(procReq)=> procReq.UXExp == UserExperience.FormFlow;

ActiveDelegate isLUISFlow =(procReq)=> procReq.UXExp == UserExperience.LUIS;

現在,在我的POST方法中,我想檢查FormFlow是活動還是LUIS,因此我會調用該函數。

public virtual async Task<HttpResponseMessage> Post([FromBody]Activity activity) 
{       
    if (activity != null) 
    { 
    // one of these will have an interface and process it 
    switch (activity.GetActivityType()) 
    { 
     case ActivityTypes.Message: 
     if (isFormFlow is TRUE) 
     { 
      await Conversation.SendAsync(activity, MakeRootDialogForm); 
     } 
     else if (isLUISFlow is TRUE) 
     { 
      await Conversation.SendAsync(activity, MakeRootDialogLUIS); 
     } 
     break; 

     case ActivityTypes.ConversationUpdate: 
     case ActivityTypes.ContactRelationUpdate: 
     case ActivityTypes.Typing: 
     case ActivityTypes.DeleteUserData: 
     default: 
     Trace.TraceError($"Unknown activity type ignored: {activity.GetActivityType()}"); 
     break; 
    } 
    } 
    return new HttpResponseMessage(System.Net.HttpStatusCode.Accepted); 
} 

請幫助我如何確定哪個代表處於活動狀態。感謝任何幫助!

回答

0

Microsoft.Bot.Builder.FormFlow.ActiveDelegate<T>在FormFlow FormDialog<T>中用於確定特定步驟是否處於活動狀態,在給定當前表單狀態的情況下。它通常不用於從多個根對話框中選擇(通常應該只有一個根對話框)。

相關問題