protected override async Task PostAsync(IActivity item, string state, CancellationToken token)
        {
            var message = item as IMessageActivity;

            if (message != null)
            {
                //var ticketForm = new FormDialog<TokenModel>(new TokenModel(), TokenModel.BuildForm, FormOptions.PromptInStart);

                var ticketForm = new RootDialog();

                var interruption = ticketForm.Void <object, IMessageActivity>();

                task.Call(interruption, null);

                await task.PollAsync(token);
            }
        }
Esempio n. 2
0
        protected override async Task PostAsync(IActivity item, string state, CancellationToken token)
        {
            //this.task.Reset();
            var message = item as IMessageActivity;

            if (message != null)
            {
                var root = new RootDialog();

                //var ticketForm = new RaiseDialog();

                var interruption = root.Void <object, IMessageActivity>();

                task.Call(interruption, null);

                await task.PollAsync(token);

                this.task.Reset();
            }
        }
Esempio n. 3
0
        //private static async Task SendGood(List<UserResgistered> results, string intentionId)
        private static async Task SendGood(List <UserEntity> results, string intentionId)
        {
            foreach (var item in results)
            {
                if (!string.IsNullOrEmpty(item.ResumptionCookie))
                {
                    try
                    {
                        var message = ResumptionCookie.GZipDeserialize(item.ResumptionCookie).GetMessage();

                        using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, message))
                        {
                            var botData = scope.Resolve <IBotData>();
                            await botData.LoadAsync(CancellationToken.None);

                            //This is our dialog stack
                            var task = scope.Resolve <IDialogTask>();

                            //interrupt the stack. This means that we're stopping whatever conversation that is currently happening with the user
                            //Then adding this stack to run and once it's finished, we will be back to the original conversation
                            var dialog = new RootDialog(item.UserId, intentionId);
                            task.Call(dialog.Void <object, IMessageActivity>(), null);

                            await task.PollAsync(CancellationToken.None);

                            //flush dialog stack
                            await botData.FlushAsync(CancellationToken.None);
                        }
                    }
                    catch (Exception)
                    {
                        // Mute errors
                    }
                }
            }
        }