예제 #1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="ApprenticeFeedbackV3"/> class.
        ///     Creates a simple Apprentice Feedback survey conversation
        /// </summary>
        /// <param name="dialogFactory"> the factory to be used for creating dialogs </param>
        /// <param name="resources">
        ///     The object to be used for string localization.
        ///     Must match the class name of the <see cref="IApprenticeFeedbackSurvey"/> implementation, and have a corresponding Resources (*.resx) file in the Resources folder.
        /// </param>
        public ApprenticeFeedbackV3(IDialogFactory <DialogSet> dialogFactory, IApprenticeFeedbackResources resources)
        {
            // Create the steps
            IDialogStep step1 = FormHelper.BuildConversationPath("daysOfTraining").WithResponse(resources.IntroWelcome)
                                .WithResponse(resources.IntroOptOut);

            IDialogStep step2Positive = FormHelper.BuildConversationPath("trainerKnowledge")
                                        .WithResponse(resources.ResponsesPositive01);

            IDialogStep step2Negative = FormHelper.BuildConversationPath("trainerKnowledge")
                                        .WithResponse(resources.ResponsesNegative01);

            IDialogStep step3Positive = FormHelper.BuildConversationPath("overallSatisfaction")
                                        .WithResponse(resources.ResponsesPositive02);

            IDialogStep step3Negative = FormHelper.BuildConversationPath("overallSatisfaction")
                                        .WithResponse(resources.ResponsesNegative02);

            IDialogStep step4Positive = FormHelper.BuildConversationPath("finish")
                                        .WithResponse(resources.ResponsesItsReallyHelpful);

            IDialogStep step4Negative = FormHelper.BuildConversationPath("finish")
                                        .WithResponse(resources.ResponsesSorryToHearThat);

            IDialogStep positiveEnd =
                FormHelper.BuildConversationEndOption().WithResponse(resources.FinishKeepUpTheGoodWork);

            IDialogStep negativeEnd = FormHelper.BuildConversationEndOption()
                                      .WithResponse(resources.FinishSpeakToYourEmployer).WithResponse(resources.FinishFormalComplaint);

            // Build the conversation, tying the steps together
            this.Dialogs = dialogFactory.Conversation()
                           .WithChoicePrompt(dialogFactory, "confirmationPrompt", ListStyle.None)
                           .WithWelcome(dialogFactory, "start", step1)
                           .WithBranch(
                dialogFactory,
                "daysOfTraining",
                resources.QuestionsDaysOfTraining,
                step2Positive,
                step2Negative)
                           .WithBranch(
                dialogFactory,
                "trainerKnowledge",
                resources.QuestionsTrainerKnowledge,
                step3Positive,
                step3Negative)
                           .WithBranch(
                dialogFactory,
                "overallSatisfaction",
                resources.QuestionsOverallSatisfaction,
                step4Positive,
                step4Negative).WithDynamicEnd(dialogFactory, "finish", 3, positiveEnd, negativeEnd);
        }