/// <summary> /// Fires the CloseFromNextEvent /// </summary> /// <param name="e">The <see cref="PageEventArgs"/> instance containing the event data.</param> /// <returns></returns> public void OnCloseFromNext(PageEventArgs e) { if (CloseFromNext != null) { CloseFromNext(this, e); } }
/// <summary> /// Fires the CloseFromBack Event /// </summary> /// <param name="wiz">Wizard to pass into the sender argument</param> /// <returns>Index of Page that the event handlers would like to see next</returns> public int OnCloseFromBack(Wizard wiz) { //Event args thinks that the next pgae will be the one before this one var e = new PageEventArgs(wiz.PageIndex - 1, wiz.Pages); //Tell anybody who listens if (CloseFromBack != null) { CloseFromBack(wiz, e); } //And then tell whomever called me what the prefered page is return(e.PageIndex); }
/// <summary> /// Closes the current page after a <see cref="WizardPage.CloseFromNext"/>, then moves to /// the Next page and calls <see cref="WizardPage.ShowFromNext"/> /// </summary> public void Next() { Debug.Assert(PageIndex >= 0, "Page Index was below 0"); //Tell the Application I just closed a Page var e = new PageEventArgs(PageIndex + 1, Pages); vActivePage.OnCloseFromNext(e); if (e.Cancel) { if (ParentForm != null) { this.ParentForm.DialogResult = DialogResult.None; } return; } //Did I just press Finish instead of Next if (PageIndex < _pages.Count - 1 && (vActivePage.IsFinishPage == false || DesignMode)) { ActivatePage(e.PageIndex); //Tell the application, I have just shown a page vActivePage.OnShowFromNext(this); } else { Debug.Assert(PageIndex < _pages.Count, "Error I've just gone past the finish", "btnNext_Click tried to go to page " + Convert.ToString(PageIndex + 1) + ", but I only have " + Convert.ToString(_pages.Count)); //yep Finish was pressed if (!DesignMode && ParentForm != null) { if (DialogResult != DialogResult.None && ParentForm.DialogResult != DialogResult) { ParentForm.DialogResult = DialogResult; } ParentForm.Close(); } } }