Example #1
0
        public static async Task Forward <T>(this DialogContext dc, ComponentDialog dialog, ResumeAfter resumeAfter, IMessageActivity message, CancellationToken cancelationToken)
        {
            var foundChild = dc.Dialogs.Find(dialog.Id);

            if (foundChild == null)
            {
                dc.Dialogs.Add(dialog);
            }

            //ensure the current Dialog has the .ResumeAfter set correctly
            var asBridge = dc.Dialogs.Find(dc.ActiveDialog.Id) as BridgeComponentDialog;

            if (asBridge != null)
            {
                dc.ActiveDialog.State["WaitMethod"] = resumeAfter.Method.Name;
                //asBridge.ResumeAfter = resumeAfter;
            }

            var instance = new DialogInstance()
            {
                Id = dialog.Id, State = new Dictionary <string, object>()
            };

            dc.Stack.Insert(0, instance);


            var result = Task.Run(() => dialog.BeginDialogAsync(dc)).Result;
        }
Example #2
0
        public static void Call <T>(this DialogContext dc, ComponentDialog dialog, ResumeAfter resumeAfter)
        {
            var foundChild = dc.Dialogs.Find(dialog.Id);

            if (foundChild == null)
            {
                dc.Dialogs.Add(dialog);
            }

            var instance = new DialogInstance()
            {
                Id = dialog.Id, State = new Dictionary <string, object>()
            };

            dc.Stack.Insert(0, instance);
            var result = Task.Run(() => dialog.BeginDialogAsync(dc)).Result;
        }