0

I can't seem to find a way to post a message to the user in the FormFlow based on how the user answers a bool. To post Fields based a previous answer you can use:

 .Field(new FieldReflector<GetQuoteDialog>(nameof(Dothis))
            .SetActive((state) => state.isDone== true))

However I haven't found a way to do the same with the .Message(). So say if I want to just send the message "Congrats!", then post the next question in the formflow.

So the dialog I would like to play out would be like:

  1. true/false question
  2. user answers true
  3. post message "Congrats" if user answers true
  4. ask next true/false question

Is there a way that I am just missing?

4

1 回答 1

1

您可以利用.Message()源代码中的第二个参数是条件委托函数:

    // Summary:
    //     Show a message that does not require a response.
    //
    // Parameters:
    //   message:
    //     A \ref patterns string to fill in and send.
    //
    //   condition:
    //     Whether or not this step is active.
    //
    //   dependencies:
    //     Fields message depends on.
    //
    // Returns:
    //     Modified IFormBuilder.
    IFormBuilder<T> Message(string message, ActiveDelegate<T> condition = null, IEnumerable<string> dependencies = null);

所以,请尝试:

.Message("Congrats", condition: (form) => form.boolField == true)
于 2017-11-09T08:11:18.203 回答