// The notion of a Validator is a standard pattern across all the Prompts private static Task TimexValidator(ITurnContext context, TimexResult value) { var cadidates = value.Resolutions; var constraints = new[] { TimexCreator.ThisWeek(), /* Take any entries for this week, no entries from past please */ TimexCreator.NextWeek(), /* Take any entries for next week, no dates from the past please */ TimexCreator.Evening, /* Evenings only */ }; var resolutions = TimexRangeResolver.Evaluate(cadidates, constraints); if (resolutions.Count == 0) { value.Resolutions = new string[] { }; value.Status = Microsoft.Bot.Builder.Prompts.PromptStatus.OutOfRange; } else { value.Resolutions = new[] { resolutions.First().TimexValue }; value.Status = Microsoft.Bot.Builder.Prompts.PromptStatus.Recognized; } return(Task.CompletedTask); }
// The notion of a Validator is a standard pattern across all the Prompts private Task TimexValidator(ITurnContext context, TimexResult value) { var resolutions = evaluateTimeX(value.Resolutions); if (resolutions.Count == 0) { value.Resolutions = new string[] { }; value.Status = Microsoft.Bot.Builder.Prompts.PromptStatus.OutOfRange; } else { value.Resolutions = new[] { resolutions.First().TimexValue }; value.Status = Microsoft.Bot.Builder.Prompts.PromptStatus.Recognized; } return(Task.CompletedTask); }