private void NextWizard() { if (iWizardUserControlList.Count == 0) { return; } IWizardUserControl iWizardUserControl; bool canNext = false; iWizardUserControl = iWizardUserControlList[currentWizardSortID] as IWizardUserControl; canNext = iWizardUserControl.CanNext(); if (!canNext) { return; } if (currentWizardSortID == iWizardUserControlList.Count - 1) { Done(); return; } Control control = iWizardUserControlList[currentWizardSortID] as Control; if (control is IWizardContainsWizardUserControl) { IWizardContainsWizardUserControl iWizardContainsWizardUserControl = control as IWizardContainsWizardUserControl; iWizardContainsWizardUserControl.WizardOfWizardDone += new WizardOfWizardDoneHandle(iWizardContainsWizardUserControl_WizardOfWizardDone); iWizardContainsWizardUserControl.Report = report; iWizardContainsWizardUserControl.ShowWizard(); } switch (wizardOfWizardDoneAction) { case WizardOfWizardDoneAction.Continue: { break; } case WizardOfWizardDoneAction.Stay: { wizardOfWizardDoneAction = WizardOfWizardDoneAction.Continue; return; } case WizardOfWizardDoneAction.Done: { Done(); return; } } currentWizardSortID++; ShowWizard(); btLast.Enabled = true; if (currentWizardSortID == iWizardUserControlList.Count - 1) { if (!isWizardOfWizard)//如果是向导的向导,则永远都显示下一步。 { btNext.Text = finishButtonText; } } }
void iWizardContainsWizardUserControl_WizardOfWizardDone(object sender, Report report, WizardOfWizardDoneAction doneAction) { this.report = report; wizardOfWizardDoneAction = doneAction; }