Esempio n. 1
0
        public ProcessChoiceDialog(string name, SchedulerViewModel vm, List <Choice> options, MainDialog md)
        {
            this.userName   = name;
            this.viewModel  = vm;
            this.choices    = options;
            this.mainDialog = md;

            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
            {
                IntroStepAsync,
                DateTimeEchoStepAsync,
                FinalStepAsync
            }));
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));
            if (md.viewAppointmentDialog == null)
            {
                md.viewAppointmentDialog = new ViewAppointmentDialog("", this.viewModel, this.mainDialog, this.choices);
            }
            AddDialog(md.viewAppointmentDialog);

            if (md.addAppointmentDialog == null)
            {
                md.addAppointmentDialog = new AddAppointmentDialog("", this.viewModel, this.mainDialog, this.choices);
            }
            AddDialog(md.addAppointmentDialog);
        }
Esempio n. 2
0
        // Dependency injection uses this constructor to instantiate MainDialog
        public MainDialog(AppointmentRecognizer luisRecognizer, ILogger <MainDialog> logger)
            : base(nameof(MainDialog))
        {
            _luisRecognizer = luisRecognizer;
            Logger          = logger;

            viewModel = new SchedulerViewModel();

            choices.Add(new Choice("Add"));
            choices.Add(new Choice("Cancel"));
            choices.Add(new Choice("View"));
            choices.Add(new Choice("Exit"));

            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));
            AddDialog(new DateTimePrompt(nameof(DateTimePrompt)));

            processChoiceDialog = new ProcessChoiceDialog("", viewModel, choices, this);
            AddDialog(processChoiceDialog);

            if (this.choiceDialog == null)
            {
                choiceDialog = new ChoiceDialog("", viewModel, choices, this);
            }
            AddDialog(choiceDialog);

            if (this.viewAppointmentDialog == null)
            {
                viewAppointmentDialog = new ViewAppointmentDialog("", viewModel, this, this.choices);
            }
            AddDialog(viewAppointmentDialog);

            if (this.addAppointmentDialog == null)
            {
                addAppointmentDialog = new AddAppointmentDialog("", viewModel, this, this.choices);
            }
            AddDialog(addAppointmentDialog);

            if (this.cancelAppointmentDialog == null)
            {
                cancelAppointmentDialog = new CancelAppointmentDialog("", viewModel, this, this.choices);
            }
            AddDialog(cancelAppointmentDialog);

            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
            {
                IntroStepAsync,
                GreetStepAsync,
                NameEchoStepAsync,
                ChoiceEchoStepAsync,
                ConformationStepAsync,
                FinalStepAsync,
            }));

            // The initial child Dialog to run.
            InitialDialogId = nameof(WaterfallDialog);
        }
        public ChoiceDialog(string name, SchedulerViewModel vm, List <Choice> options, MainDialog md)
        {
            this.userName   = name;
            this.viewModel  = vm;
            this.choices    = options;
            this.mainDialog = md;

            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
            {
                IntroStepAsync,
                ChoiceEchoStepAsync,
                FinalStepAsync
            }));
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));
        }
        public ViewAppointmentDialog(string name, SchedulerViewModel vm, MainDialog md, List <Choice> options)
        {
            this.userName   = name;
            this.viewModel  = vm;
            this.mainDialog = md;
            this.choices    = options;

            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
            {
                IntroStepAsync,
            }));
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));
            if (this.mainDialog.choiceDialog == null)
            {
                this.mainDialog.choiceDialog = new ChoiceDialog("", this.viewModel, this.choices, this.mainDialog);
            }
            AddDialog(this.mainDialog.choiceDialog);
        }