示例#1
0
        /// <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.OK)
                {
                    this.buttonCancel.Text         = "OK";
                    this.buttonCancel.DialogResult = DialogResult.OK;
                }
                else
                {
                    this.buttonCancel.Text         = "Cancella";
                    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.Pages[this.SelectedIndex].Style == WizardPageStyle.Custom ||
                 this.DesignMode == true))
            {
                this.buttonNext.Enabled = true;
            }
            else
            {
                if (this.DesignMode == false && this.selectedPage.Style == WizardPageStyle.Finish)
                {
                    // 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();
            }
        }
示例#2
0
        /// <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);
        }
示例#3
0
 /// <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));
 }
示例#4
0
 /// <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);
 }
示例#5
0
 /// <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);
 }
示例#6
0
 /// <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));
 }