//This will interrupt the conversation and send the user to SurveyDialog, then wait until that's done public static async Task Resume() { var message = JsonConvert.DeserializeObject <ConversationReference>(conversationReference).GetPostToBotMessage(); var client = new ConnectorClient(new Uri(message.ServiceUrl)); using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, message)) { var botData = scope.Resolve <IBotData>(); await botData.LoadAsync(CancellationToken.None); var task = scope.Resolve <IDialogTask>(); //Do we have a root dialog yet? if (task.Frames.Count == 0) { var root = Chain.Loop(new RootDialog()); task.Call(root, null); await task.PollAsync(CancellationToken.None); } //interrupt the stack var dialog = new SurveyDialog(); task.Call(dialog.Void <object, IMessageActivity>(), null); await task.PollAsync(CancellationToken.None); //flush dialog stack await botData.FlushAsync(CancellationToken.None); } }
//This will interrupt the conversation and send the user to SurveyDialog, then wait until that's done public static async Task Resume() { var message = ResumptionCookie.GZipDeserialize(resumptionCookie).GetMessage(); var client = new ConnectorClient(new Uri(message.ServiceUrl)); using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, message)) { var botData = scope.Resolve <IBotData>(); await botData.LoadAsync(CancellationToken.None); var stack = scope.Resolve <IDialogStack>(); //interrupt the stack var dialog = new SurveyDialog(); stack.Call(dialog.Void <object, IMessageActivity>(), null); await stack.PollAsync(CancellationToken.None); //flush dialog stack await botData.FlushAsync(CancellationToken.None); } }