如何识别Microsoft Bot框架IForm中哪个ActiveDelegate为TRUE?

时间:2017-01-02 09:42:32

标签: botframework

我有两个ActiveDelegate(S):

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);
}

请帮助我确定如何识别哪个代表是活动的。感谢任何帮助!

1 个答案:

答案 0 :(得分:0)

在给定当前表单状态的情况下,在FormFlow Microsoft.Bot.Builder.FormFlow.ActiveDelegate<T>中使用

FormDialog<T>来确定特定步骤是否处于活动状态。它通常不用于从多个根对话框中进行选择(通常只有一个根对话框)。

相关问题