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));
 }
示例#2
0
        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);
            }
        }
示例#3
0
        public static async Task HandleSesamErrors(List <ISesamError> errors, ResumptionCookie cookie, CancellationToken token)
        {
            var container = WebApiApplication.FindContainer();

            await HandleSesamErrors(container, errors, cookie, token);
        }
示例#4
0
 /// <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;
 }