Exemplo n.º 1
0
        public async Task StartAsync(IDialogContext context)
        {
            var msg = await MessageActivityHelper.CreateCardActionMessage(context, new List <CardAction>()
            {
                new CardAction()
                {
                    Title = "Mina fakturor", Type = ActionTypes.PostBack, Value = "Mina fakturor"
                },
                new CardAction()
                {
                    Title = "Ränta och avgifter", Type = ActionTypes.ImBack, Value = "Ränta och avgifter"
                },
                new CardAction()
                {
                    Title = "Leverans och retur", Type = ActionTypes.ImBack, Value = "Leverans och retur"
                },
                new CardAction()
                {
                    Title = "Kreditupplysningar", Type = ActionTypes.ImBack, Value = "Kreditupplysningar"
                },
                new CardAction()
                {
                    Title = "Bedrägeri", Type = ActionTypes.ImBack, Value = "Bedrägeri"
                }
            });

            await context.PostAsync(msg);

            context.Wait(this.MessageReceivedAsync);
        }
Exemplo n.º 2
0
        public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var message          = await result;
            var messageText      = message.Text;
            IMessageActivity msg = null;

            switch (messageText)
            {
            case "Mina fakturor":
                msg = await MessageActivityHelper.CreateCardActionMessage(context, new List <CardAction>()
                {
                    new CardAction()
                    {
                        Title = "Fakturaleverans", Type = ActionTypes.PostBack, Value = "Fakturaleverans", DisplayText = "Fakturaleverans info displaytext", Text = "Fakturaleverans info text"
                    }
                });

                await context.PostAsync(msg);

                break;

            case "Fakturaleverans":
                msg = await MessageActivityHelper.CreateCardActionMessage(context, new List <CardAction>()
                {
                    new CardAction()
                    {
                        Title = "Hur skickas min faktura?", Type = ActionTypes.PostBack, Value = "Hur skickas min faktura?"
                    },
                    new CardAction()
                    {
                        Title = "Varför ser jag inte min faktura?", Type = ActionTypes.PostBack, Value = "Varför ser jag inte min faktura?"
                    },
                    new CardAction()
                    {
                        Title = "Samma faktura på flera sätt", Type = ActionTypes.PostBack, Value = "Samma faktura på flera sätt"
                    },
                    new CardAction()
                    {
                        Title = "Varför har jag fått en faktura från Collector?", Type = ActionTypes.PostBack, Value = "Varför har jag fått en faktura från Collector?"
                    }
                });

                await context.PostAsync(msg);

                break;

            default:
                break;
            }

            context.Wait(this.MessageReceivedAsync);
        }
Exemplo n.º 3
0
        public async Task StartAsync(IDialogContext context)
        {
            //_botService = new BotCMSService();


            await context.PostAsync($"BOT CMS Dialog");

            var initialNodeId = "465";
            await context.PostAsync(await BotCMSService.GetBotSaysAsync(initialNodeId));

            var msg = await MessageActivityHelper.CreateCardActionMessage(context, await BotCMSService.GetYouSaysAsync(initialNodeId));

            await context.PostAsync(msg);

            context.Wait(this.MessageReceivedAsync);
        }
Exemplo n.º 4
0
        private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var message = await result;

            string nodeId;

            try
            {
                nodeId = message.Text;
            }
            catch (Exception)
            {
                await context.PostAsync("Kunde inte läsa av meddelandetexten..");

                context.Done(this);
                return;
            }

            // Show next stuff
            await context.PostAsync(await BotCMSService.GetBotSaysAsync(nodeId));

            var msg = await MessageActivityHelper.CreateCardActionMessage(context, await BotCMSService.GetYouSaysAsync(nodeId));

            await context.PostAsync(msg);

            if (msg.SuggestedActions.Actions.Count <= 0)
            {
                await context.PostAsync("Vill du veta något mer?");

                context.Done(this);
            }
            else
            {
                context.Wait(this.MessageReceivedAsync);
            }
        }