Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public InitialQuestions(string dialogId, IEnumerable<WaterfallStep> steps = null)
- : base(dialogId, steps)
- {
- AddStep(async (stepContext, cancellationToken) =>
- {
- var cardAttachment = CreateAdaptiveCardAttachment(_cards);
- var reply = stepContext.Context.Activity.CreateReply();
- reply.Attachments = new List<Attachment>() { cardAttachment };
- await stepContext.Context.SendActivityAsync(reply, cancellationToken);
- // how can i wait for user to click submit before going to next step?
- return await stepContext.NextAsync();
- // return await stepContext.PromptAsync(
- // "textPrompt",
- // new PromptOptions
- // {
- // Prompt = MessageFactory.Text(""),
- // },
- // cancellationToken: cancellationToken);
- });
- AddStep(async (stepContext, cancellationToken) =>
- {
- // next step
- });
- }
- private static Attachment CreateAdaptiveCardAttachment(string filePath)
- {
- var adaptiveCardJson = File.ReadAllText(filePath);
- var adaptiveCardAttachment = new Attachment()
- {
- ContentType = "application/vnd.microsoft.card.adaptive",
- Content = JsonConvert.DeserializeObject(adaptiveCardJson),
- };
- return adaptiveCardAttachment;
- }
- {
- "type": "AdaptiveCard",
- "body": [
- {
- "type": "TextBlock",
- "text": "What is your Occupation?"
- },
- {
- "type": "Input.Text",
- "id": "SimpleVal",
- "placeholder": "Occupation"
- },
- {
- "type": "TextBlock",
- "text": "Are you married? "
- },
- {
- "type": "Input.ChoiceSet",
- "id": "SingleSelectVal",
- "value": "true",
- "choices": [
- {
- "title": "Yes",
- "value": "true"
- },
- {
- "title": "No",
- "value": "false"
- }
- ],
- "style": "expanded"
- },
- {
- "type": "TextBlock",
- "text": "When is your birthday?"
- },
- {
- "type": "Input.Date",
- "id": "DateVal",
- "value": ""
- }
- ],
- "actions": [
- {
- "type": "Action.Submit",
- "title": "Submit",
- "data": {
- "id": "1234567890"
- }
- }
- ],
- "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
- "version": "1.0"
- }
Add Comment
Please, Sign In to add comment