Exemplo n.º 1
0
        private async Task CaptureLeadComplete(IDialogContext context, IAwaitable <PayArticles> result)
        {
            var activity = (context.Activity as Activity);

            PayArticles order = null;

            try
            {
                order = await result;
            }
            catch (OperationCanceledException)
            {
                await context.PostAsync("You canceled the form!");

                return;
            }

            if (order != null)
            {
                await context.PostAsync("Ok, enviado, obrigado pela confiança , lembre-se pode digitar **ajuda** \n" +
                                        "Posso ajudar em algo mais ?");

                await Services.Email.SendEmail("Anuncio Pago", order.ToString());
            }
            else
            {
                await context.PostAsync("Form returned empty response!");
            }

            context.Wait(MessageReceived);
        }
Exemplo n.º 2
0
        public async Task RequestQuoteForm(IDialogContext context, LuisResult result)
        {
            var activity    = (context.Activity as Activity);
            var capLeadForm = new PayArticles();
            var entities    = new List <EntityRecommendation>(result.Entities);

            var form = new FormDialog <PayArticles>(capLeadForm, PayArticles.BuildForm, FormOptions.PromptInStart, entities);

            context.Call <PayArticles>(form, CaptureLeadComplete);

            //await Conversation.SendAsync(activity, () => Chain.From(() => FormDialog.FromForm(() => CaptureLead.BuildForm(), FormOptions.PromptFieldsWithValues)));
        }