private static Page GetPageFromWizardPage(WizardPage page) { return (Page) page.Tag; }
/// <summary> /// Returns index of the object inside of the collection. /// </summary> /// <param name="value">Reference to the object.</param> /// <returns>Index of the object.</returns> public int IndexOf(WizardPage value) { return List.IndexOf(value); }
private void SetupWizardPage(WizardPage wizardPage, Page page) { wizardPage.Tag = page; pages.Add(page, wizardPage); }
/// <summary> /// Adds an array of objects to the collection. /// </summary> /// <param name="WizardPages">Array of WizardPage objects.</param> public void AddRange(WizardPage[] WizardPages) { foreach(WizardPage WizardPage in WizardPages) List.Add(WizardPage); }
/// <summary> /// Inserts new object into the collection. /// </summary> /// <param name="index">Position of the object.</param> /// <param name="value">Object to insert.</param> public void Insert(int index, WizardPage value) { List.Insert(index, value); }
public void CopyTo(WizardPage[] array) { List.CopyTo(array,0); }
/// <summary> /// Adds new object to the collection. /// </summary> /// <param name="WizardPage">Object to add.</param> /// <returns>Index of newly added object.</returns> public int Add(WizardPage WizardPage) { return List.Add(WizardPage); }
/// <summary> /// Removes specified object from the collection. /// </summary> /// <param name="value"></param> public void Remove(WizardPage value) { List.Remove(value); }
/// <summary> /// Copies collection into the specified array. /// </summary> /// <param name="array">Array to copy collection to.</param> /// <param name="index">Starting index.</param> public void CopyTo(WizardPage[] array, int index) { List.CopyTo(array, index); }
/// <summary> /// Creates new instance of the class with default values. /// </summary> /// <param name="newPage">New wizard page</param> /// <param name="oldPage">Old or current wizard page</param> /// <param name="pageChangeSource">Page change source</param> public WizardCancelPageChangeEventArgs(WizardPage newPage, WizardPage oldPage, eWizardPageChangeSource pageChangeSource) : base(newPage, oldPage, pageChangeSource) { }
/// <summary> /// Returns whether collection contains specified object. /// </summary> /// <param name="value">Object to look for.</param> /// <returns>true if object is part of the collection, otherwise false.</returns> public bool Contains(WizardPage value) { return List.Contains(value); }
/// <summary> /// Creates new instance of the class with default values. /// </summary> /// <param name="newPage">New wizard page</param> /// <param name="oldPage">Old or current wizard page</param> /// <param name="pageChangeSource">Page change source</param> public WizardPageChangeEventArgs(WizardPage newPage, WizardPage oldPage, eWizardPageChangeSource pageChangeSource) { this.NewPage = newPage; this.OldPage = oldPage; this.PageChangeSource = pageChangeSource; }
internal void SetupPage(WizardPage page) { if (page == null) return; Size innerPadding = new Size(7, 12); this.SuspendLayout(); try { Rectangle bounds = Rectangle.Empty; if (page.InteriorPage) { bounds = new Rectangle(this.ClientRectangle.X + innerPadding.Width, this.ClientRectangle.Y + panelHeader.Height + innerPadding.Height, this.ClientRectangle.Width - innerPadding.Width * 2, this.ClientRectangle.Height - (panelHeader.Height + panelFooter.Height + innerPadding.Height * 2)); } else { bounds = new Rectangle(this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width, this.ClientRectangle.Height - panelFooter.Height); } TypeDescriptor.GetProperties(page)["Bounds"].SetValue(page, bounds); TypeDescriptor.GetProperties(page)["Anchor"].SetValue(page, AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom); } finally { this.ResumeLayout(); } }
private bool ShowPage(WizardPage page, eWizardPageChangeSource changeSource) { WizardPage oldPage = this.SelectedPage; WizardCancelPageChangeEventArgs e = new WizardCancelPageChangeEventArgs(page, oldPage, changeSource); OnWizardPageChanging(e); if (e.Cancel || e.NewPage==null) return false; page = e.NewPage; if (page != null) { page.InvokeBeforePageDisplayed(e); if (e.Cancel || e.NewPage == null) return false; page = e.NewPage; } if (m_PageChangeDisableButtons) { buttonBack.Enabled = false; buttonNext.Enabled = false; buttonFinish.Enabled = false; buttonCancel.Enabled = false; } if(m_PageChangeWaitCursor) this.Cursor = Cursors.WaitCursor; // Change the page if (oldPage != null) { if (oldPage != page) { if (this.DesignMode) TypeDescriptor.GetProperties(oldPage)["Visible"].SetValue(oldPage, false); oldPage.Visible = false; oldPage.InvokeAfterPageHidden(new WizardPageChangeEventArgs(page, oldPage, changeSource)); } else { foreach (WizardPage wp in this.WizardPages) { if (wp != page) { if (this.DesignMode) TypeDescriptor.GetProperties(wp)["Visible"].SetValue(wp, false); wp.Visible = false; } } } } if (page != null) { if (this.DesignMode) TypeDescriptor.GetProperties(page)["Visible"].SetValue(page, true); page.Visible = true; } m_SelectedPageIndex = m_WizardPages.IndexOf(page); SetupButtons(true); // Raise event e.Cancel = false; OnWizardPageChanged(e); if (page != null) { page.InvokeAfterPageDisplayed(new WizardPageChangeEventArgs(page, oldPage, changeSource)); } UpdatePageDisplay(); if (m_PageChangeWaitCursor) this.Cursor = Cursors.Default; return true; }
internal void OnWizardPageRemoved(WizardPage page) { this.Controls.Remove(page); if (page.Visible && this.SelectedPage!=null && !this.SelectedPage.Visible) { ShowPage(this.SelectedPage, eWizardPageChangeSource.Code); } }
internal void OnWizardPageAdded(WizardPage page) { SetupPage(page); if (m_WizardPages.IndexOf(page) == m_SelectedPageIndex) ShowPage(page, eWizardPageChangeSource.Code); else page.Visible = false; this.Controls.Add(page); SetupButtons(true); }