/// <summary> /// Creates a 'prompt for feedback' activity with message text and feedback actions defined by passed FeedbackOptions param. /// </summary> /// <param name="context">ITurnContext used to extract channel info to ensure feedback actions are renderable in current channel.</param> /// <param name="feedbackOptions">FeedbackOptions instance used to customize feedback experience.</param> /// <returns> /// A 'prompt for feedback' Activity. /// Has feedback options displayed in a manner supported by the current channel. /// </returns> public static Activity CreateFeedbackActivity(ITurnContext context, FeedbackOptions feedbackOptions = null) { // Check for null options param, if null, instanticate default feedbackOptions = feedbackOptions == null ? new FeedbackOptions() : feedbackOptions; var feedbackActivity = ChoiceFactory.ForChannel(context.Activity.ChannelId, new List<Choice>(feedbackOptions.FeedbackActions) { feedbackOptions.DismissAction }, feedbackOptions.FeedbackPromptMessage); return (Activity)feedbackActivity; }
/// <summary> /// Creates a 'prompt for feedback comment' activity with message text and dismess action defined by passed FeedbackOptions param. /// </summary> /// <param name="context">ITurnContext used to extract channel info to ensure dismiss action is renderable in current channel.</param> /// <param name="feedbackOptions">FeedbackOptions instance used to customize comment prompt text and dismiss action.</param> /// <returns> /// A 'prompt for feedback comment' Activity. /// Has dismiss option displayed in a manner supported by the current channel. /// </returns> public static Activity GetFeedbackCommentPrompt(ITurnContext context, FeedbackOptions feedbackOptions = null) { // Check for null options param, if null, instanticate default feedbackOptions = feedbackOptions == null ? new FeedbackOptions() : feedbackOptions; var message = ChoiceFactory.ForChannel(context.Activity.ChannelId, new List<Choice>() { feedbackOptions.DismissAction }, $"{feedbackOptions.FeedbackReceivedMessage} {feedbackOptions.CommentPrompt}"); return (Activity)message; }