private async Task resumeAfterSupportFormDialog(IDialogContext context, IAwaitable <SupportForm> result) { var formResult = await result; ProblemType = formResult.problemTypeOptions.ToString(); Category = formResult.category; state = SupportDialogState.SupportFormDone; await AdaptiveCardUtils.DisplayAdaptiveCard(context, "Resources/DescriptionAdaptiveCard.json"); context.Wait(this.MessageReceivedAsync); }
public async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> argument) { var activity = await argument; string errorInfo = null; if (this.state == SupportDialogState.ShowContactCard) { await this.DisplayContactCard(context); this.state = SupportDialogState.ReceivedContactCard; context.Wait(this.MessageReceivedAsync); } else if (this.state == SupportDialogState.ReceivedContactCard) { var contactInfo = activity.Value; var response = Utils.convertResponseToMap(contactInfo); if (validatedata(contactInfo, out errorInfo)) { await context.Forward(MakeSupportFormDialog(), resumeAfterSupportFormDialog, activity, CancellationToken.None); } else { if (this.retries < 3) { this.retries++; await this.DisplayContactCard(context, errorInfo); context.Wait(this.MessageReceivedAsync); } else { await context.PostAsync("Maximum retry limit exceeded. Please start again."); context.Done(true); } } } else if (this.state == SupportDialogState.SupportFormDone) { this.Description = Utils.convertResponseToMap(activity.Value)[Constants.Description]; JToken value; string accountUrl = ""; if (context.Activity.From.Properties.TryGetValue("host", out value)) { accountUrl = value.ToString(); } SupportTicket ticket = new SupportTicket() { AccountUrl = accountUrl, UserName = this.UserName, EmailAddress = this.EmailAddress, AreaOfProblem = this.ProblemType, CategoryOfProblem = this.Category, Description = this.Description }; var supportTicketUrl = WorkItemUtils.CreateSupportTicket(ticket); //await AdaptiveCardUtils.DisplayAdaptiveCard(context, SupportTicketCardJSONSchemaPath); await DisplaySupportTicketCard(context, supportTicketUrl, ticket); context.Done(true); return; } }
public async Task StartAsync(IDialogContext context) { state = SupportDialogState.ShowContactCard; //ticket = new SupportTicket(); context.Wait(this.MessageReceivedAsync); }