Ejemplo n.º 1
0
        public async Task <DialogTurnResult> GetAddressForLocationAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            await stepContext.Context.SendActivityAsync(MessageFactory.Text($"I can help you with that."));

            string address = PplLocations.ContainsKey(LocationEntity) ? PplLocations[LocationEntity] : string.Empty;

            if (!string.IsNullOrEmpty(address))
            {
                await stepContext.Context.SendActivityAsync(MessageFactory.Text($"{address}"));
            }
            else
            {
                await stepContext.Context.SendActivityAsync(MessageFactory.Text($"Sorry, I don't seem to have an address for that location, is there anywhere else I can help you find?"));
            }

            return(await stepContext.NextAsync(null, cancellationToken));
        }
Ejemplo n.º 2
0
 public static async Task <bool> ValidateLocationAsync(PromptValidatorContext <string> promptContext, CancellationToken cancellationToken)
 {
     return(!string.IsNullOrWhiteSpace(LocationEntity) && PplLocations.ContainsKey(LocationEntity));
 }