/// <summary>
 /// Creates a new Wizard step.
 /// </summary>
 /// <param name="header">The image and label header to assign this step</param>
 /// <param name="control">The control to display when this step is activated.</param>
 /// <param name="verify">A verification callback that will be triggered prior to advancing
 /// past this step. If this callback returns false, the step will not advance.</param>
 /// <param name="next">A callback that will be triggered after the step has been verified
 /// and just before advancing to the next step. Steps can use this callback to add additional
 /// substeps prior to moving past this step.</param>
 /// <param name="back">A callback that will be triggered when the Wizard is going back one step.
 /// WizardSteps can use this callback to rollback any stateful side effects that may have occurred
 /// as a result of previously executing this step.</param>
 public WizardStep(UserControl control, StringId? header, WizardController.DisplayCallback display, WizardController.VerifyStepCallback verify, WizardController.NextCallback next, WizardController.NextCallback undoNext, WizardController.BackCallback back)
 {
     Control = control;
     Header = header;
     DisplayHandler = display;
     VerifyHandler = verify;
     NextHandler = next;
     UndoNextHandler = undoNext;
     BackHandler = back;
 }
Пример #2
0
        /// <summary>
        /// Displays the current wizard step.
        /// </summary>
        internal protected void DisplayWizardStep(WizardStep step, int currentStep, int totalSteps)
        {
            SuspendLayout();
            try
            {
                //step.Control.Visible = true;
                SetWizardBody(step.Control);

                this.Header = step.Header;
                if (step.NextButtonLabel != null)
                {
                    NextButtonText = step.NextButtonLabel;
                }
                else
                {
                    if (currentStep == totalSteps - 1)
                    {
                        NextButtonText = BUTTON_TEXT_FINISH;
                    }
                    else
                    {
                        NextButtonText = BUTTON_TEXT_NEXT;
                    }
                }

                if (currentStep == 0)
                {
                    buttonBack.Enabled = false;
                }
                else
                {
                    buttonBack.Enabled = true;
                }

                this.buttonBack.Visible = totalSteps > 1;

                //drive focus to the new body control (only if the step control didn't manually drive
                //focus to one of its sub-controls)
                if (step.Control.ActiveControl == null)
                {
                    if (step.WantsFocus)
                    {
                        wizardBody.Select();
                        wizardBody.SelectNextControl(wizardBody, true, true, true, true);
                    }
                    else
                    {
                        buttonNext.Select();
                    }
                }
            }
            finally
            {
                ResumeLayout();
            }
        }