Beispiel #1
0
        /// <summary>
        /// Moves the wizard forward one step.
        /// </summary>
        public void next()
        {
            try
            {
                WizardStep step = (WizardStep)wizardSteps[wizardStepIndex];
                if (!step.Verify())
                {
                    //the step validation failed, so don't proceed.
                    //Note: This assumes that the step displayed an error message
                    //indicating why the step didn't proceed.
                    return;
                }

                CancelEventArgs cea = new CancelEventArgs();
                if (NextCalled != null)
                {
                    NextCalled(this, cea);
                }
                if (cea.Cancel)
                {
                    return;
                }

                //Note: the step.Next() must occur before incrementing the step
                //index just in case the Next() operation adds substeps.
                step.Next();
                if (wizardStepIndex < wizardSteps.Count - 1)
                {
                    WizardStepIndex++;
                }
                else
                {
                    Finish();
                }
            }
            catch (CancelNextException)
            {
                //next was cancelled.
            }
            catch (OperationCancelledException)
            {
                this.WizardControl.Cancel();
            }
        }