示例#1
0
        public async Task GetEndTime(IDialogContext context, IAwaitable <IMessageActivity> argument)
        {
            var text = (await argument).Text;

            if (string.IsNullOrEmpty(text) || text.ToLowerInvariant() == "cancel" || text.ToLowerInvariant() == "stop")
            {
                context.Done <RoomSearchCriteria>(null);
                return;
            }

            var svc    = GetLuisService();
            var result = await svc.QueryAsync(text, CancellationToken.None);

            _criteria.LoadEndTimeCriteria(result, context.GetTimezone());

            if (!_criteria.EndTime.HasValue)
            {
                await context.PostAsync(context.CreateMessage($"Sorry, I couldn't understand that end time or duration.", InputHints.IgnoringInput));
                await PromptForEndTime(context);

                return;
            }

            await PromptNext(context);
        }
示例#2
0
 public async Task CheckRoom(IDialogContext context, LuisResult result)
 {
     var criteria = RoomStatusCriteria.ParseCriteria(result, context.GetTimezone());
     await context.Forward(new RoomStatusCriteriaDialog(criteria), DoRoomCheck, context.Activity, new CancellationToken());
 }