/// <summary> /// Adds the elements of an array of WizardPage objects to the end of the WizardPagesCollection. /// </summary> /// <param name="pages">An array on WizardPage objects to be added. /// The array itself cannot be null, but it can contain elements that are null.</param> public void AddRange(WizardPage[] pages) { // Use external to validate and add each entry foreach(WizardPage page in pages) { this.Add(page); } }
/// <summary> /// Activates the specified wizard bage. /// </summary> /// <param name="page">A WizardPage object representing the page to be activated.</param> private void ActivatePage(WizardPage page) { // validate given page if (this.pages.Contains(page) == false) { // filter out return; } // deactivate current page if (this.selectedPage != null) { this.selectedPage.Visible = false; } // activate new page this.selectedPage = page; if (this.selectedPage != null) { //Ensure that this panel displays inside the wizard this.selectedPage.Parent = this; if (this.Contains(this.selectedPage) == false) { this.Container.Add(this.selectedPage); } if (this.selectedPage.Style == WizardPageStyle.Finish) { this.buttonCancel.Text = "OK"; this.buttonCancel.DialogResult = DialogResult.OK; } else { this.buttonCancel.Text = "Cancel"; this.buttonCancel.DialogResult = DialogResult.Cancel; } //Make it fill the space this.selectedPage.SetBounds(0, 0, this.Width, this.Height - FOOTER_AREA_HEIGHT); this.selectedPage.Visible = true; this.selectedPage.BringToFront(); this.FocusFirstTabIndex(this.selectedPage); } //What should the back button say if (this.SelectedIndex > 0) { buttonBack.Enabled = true; } else { buttonBack.Enabled = false; } //What should the Next button say if (this.SelectedIndex < this.pages.Count - 1) { this.buttonNext.Enabled = true; } else { if (this.DesignMode == false) { // at runtime disable back button (we finished; there's no point going back) buttonBack.Enabled = false; } this.buttonNext.Enabled = false; } // refresh if (this.selectedPage != null) { this.selectedPage.Invalidate(); } else { this.Invalidate(); } }
/// <summary> /// Determines whether an element is in the WizardPagesCollection. /// </summary> /// <param name="value">The WizardPage object to locate. The value can be null.</param> /// <returns>true if item is found in the WizardPagesCollection; otherwise, false.</returns> public bool Contains(WizardPage value) { return List.Contains(value); }
/// <summary> /// Removes the first occurrence of a specific object from the WizardPagesCollection. /// </summary> /// <param name="value">A WizardPage object to remove. The value can be null.</param> public void Remove(WizardPage value) { // remove the item List.Remove(value); }
/// <summary> /// Adds an object to the end of the WizardPagesCollection. /// </summary> /// <param name="value">The WizardPage to be added. /// The value can be null.</param> /// <returns>An Integer value representing the index at which the value has been added.</returns> public int Add(WizardPage value ) { int result = List.Add( value ); return result; }
/// <summary> /// Searches for the specified WizardPage and returns the zero-based index /// of the first occurrence in the entire WizardPagesCollection. /// </summary> /// <param name="value">A WizardPage object to locate in the WizardPagesCollection. /// The value can be null.</param> /// <returns></returns> public int IndexOf(WizardPage value) { return List.IndexOf(value); }
/// <summary> /// Inserts an element into the WizardPagesCollection at the specified index. /// </summary> /// <param name="index">An Integer value representing the zero-based index at which value should be inserted.</param> /// <param name="value">A WizardPage object to insert. The value can be null.</param> public void Insert( int index, WizardPage value ) { // insert the item List.Insert(index, value ); }