Example #1
0
        protected override void OnControlAdded(ControlEventArgs e)
        {
            // Invoke base class implementation
            base.OnControlAdded(e);

            // Set default properties for all WizardPage instances added to
            // this form
            CCWizardPage page = e.Control as CCWizardPage;

            if (page != null)
            {
                page.Visible  = false;
                page.Location = this.Location;
                //page.Size = new Size(Width, m_separator.Location.Y);
                page.Dock = DockStyle.Fill;

                panel1.Controls.Add(page);

                m_pages.Add(page);
                if (m_selectedIndex == -1)
                {
                    m_selectedIndex = 0;
                }
            }
        }
Example #2
0
 private void OnClickFinish(object sender, EventArgs e)
 {
     // Ensure a page is currently selected
     if (m_selectedIndex != -1)
     {
         // Inform selected page that the Finish button was clicked
         CCWizardPage page = (CCWizardPage)m_pages[m_selectedIndex];
         if (page.OnWizardFinish())
         {
             // Deactivate page and close wizard
             //if (page.OnKillActive())
             //    DialogResult = DialogResult.OK;
         }
     }
 }
Example #3
0
        private void ActivatePage(int newIndex)
        {
            // Ensure the index is valid
            if (newIndex < 0 || newIndex >= m_pages.Count)
            {
                throw new ArgumentOutOfRangeException();
            }

            // Deactivate the current page if applicable
            CCWizardPage currentPage = null;

            if (m_selectedIndex != -1)
            {
                currentPage = (CCWizardPage)m_pages[m_selectedIndex];
                if (!currentPage.OnKillActive())
                {
                    return;
                }
            }

            // Activate the new page
            CCWizardPage newPage = (CCWizardPage)m_pages[newIndex];

            if (!newPage.OnSetActive())
            {
                return;
            }

            // Update state
            m_selectedIndex = newIndex;
            if (currentPage != null)
            {
                currentPage.Visible = false;
            }
            newPage.Visible = true;
            newPage.Focus();
        }