示例#1
0
        private async Task <DialogTurnResult> FinalStepAsync(WaterfallStepContext stepContext,
                                                             CancellationToken cancellationToken)
        {
            if (stepContext.Result is BookingDetails result)
            {
                var messageText = "Your link for booking ticket";
                messageText = language == TranslationSettings.defaultLanguage ? messageText :
                              (await translationService.TranslateAsync(new TranslatorRequest[] { new TranslatorRequest(messageText) }, language))[0];
                var reply    = MessageFactory.Attachment(new List <Attachment>());
                var heroCard = new HeroCard()
                {
                    Title = messageText,
                    Tap   = new CardAction()
                    {
                        Type  = ActionTypes.OpenUrl,
                        Value = cinemaService.GetOrderTicketUri(result.Movie.Code, result.Show.Id)
                    }
                };
                reply.Attachments.Add(heroCard.ToAttachment());
                await stepContext.Context.SendActivityAsync(reply, cancellationToken);
            }
            await needToTranslateProperty.SetAsync(stepContext.Context, true, cancellationToken);

            var promptMessage = "What else can I do?";

            return(await stepContext.ReplaceDialogAsync(InitialDialogId, promptMessage, cancellationToken));
        }