public void test5() { var pageCollection = new PageCollection(); var page = new Page { Index = 42 }; var index = pageCollection.IndexOf(page); AssertSame(42, index); }
protected internal void ActivatePage(WizardPage page) { //Deactivate the current if (vActivePage != null) { vActivePage.Visible = false; } //Activate the new page vActivePage = page; if (vActivePage != null) { //Ensure that this panel displays inside the wizard vActivePage.Parent = this; if (this.Contains(vActivePage) == false) { this.Container.Add(vActivePage); } //Make it fill the space vActivePage.Dock = DockStyle.Fill; vActivePage.Visible = true; vActivePage.BringToFront(); vActivePage.FocusFirstTabIndex(); } //What should the back button say if (this.PageIndex > 0) { btnBack.Enabled = true; } else { btnBack.Enabled = false; } //What should the Next button say if (vPages.IndexOf(vActivePage) < vPages.Count - 1 && vActivePage.IsFinishPage == false) { btnNext.Text = "&Next >"; btnNext.Enabled = true; //Don't close the wizard :) btnNext.DialogResult = DialogResult.None; } else { btnNext.Text = "Fi&nish"; //Dont allow a finish in designer if (DesignMode == true && vPages.IndexOf(vActivePage) == vPages.Count - 1) { btnNext.Enabled = false; } else { btnNext.Enabled = true; //If Not in design mode then allow a close btnNext.DialogResult = DialogResult.OK; } } //Cause a refresh if (vActivePage != null) { vActivePage.Invalidate(); } else { this.Invalidate(); } }
void multiBoard_SwitchTabRequested(object sender, bool reverse) { tabs.CurrentPage = tabs[PositiveMod(tabs.IndexOf(tabs.CurrentPage) + (reverse ? -1 : 1), tabs.Count)]; }