public async Task <HttpResponseMessage> Post([FromBody] Activity activity, CancellationToken token) { if (activity != null) { switch (activity.GetActivityType()) { case ActivityTypes.Message: var container = WebApiApplication.FindContainer(); using (var scope = DialogModule.BeginLifetimeScope(container, activity)) { await Conversation.SendAsync(activity, () => scope.Resolve <IDialog <object> >(), token); } break; } } return(new HttpResponseMessage(HttpStatusCode.Accepted)); }
private async Task AfterLevelSelected(IDialogContext context, IAwaitable <string> result) { try { var selection = await result; // TODO: choose lesson plan based on level selection. currently just automatically navigating to // the one lesson plan that we have using (var scope = WebApiApplication.FindContainer().BeginLifetimeScope()) { context.Call(scope.Resolve <LessonPlanDialog>(), this.AfterLevelFinished); } } catch (TooManyAttemptsException) { await this.StartAsync(context); } }
public static async Task HandleSesamErrors(List <ISesamError> errors, ResumptionCookie cookie, CancellationToken token) { var container = WebApiApplication.FindContainer(); await HandleSesamErrors(container, errors, cookie, token); }
/// <summary> /// Initializes a new instance of the <see cref="MessagesController"/> class. /// </summary> /// <param name="provider">The provider.</param> public MessagesController(ILuisCommunicationManagerProvider provider) { this.scope = WebApiApplication.FindContainer(); this.provider = provider; }