Ejemplo n.º 1
0
        /// <summary>
        /// Show Wizard Page. m_iShowIndex is identifier of page which 
        /// Wizard control must show
        /// </summary>
        protected void ShowWizardPage()
        {
            // do not show one page twice
              if( m_iShowIndex == m_iLastShown ) return;

              pnlMain.SuspendLayout();
              pnlBody.SuspendLayout();

              pnlMain.Controls.Clear();
              pnlBody.Controls.Clear();

              // check if control has any pages
              if( m_pages.Count > 0 )
              {
            m_pages.Sort();

            // check m_iShowIndex
            if( m_iShowIndex < 0 ) m_iShowIndex = 0;
            if( m_iShowIndex >= m_pages.Count ) m_iShowIndex = m_pages.Count - 1;

            m_CurrentPage = m_pages[ m_iLastShown = m_iShowIndex ];

            // set page parent correctly in case when is something wrong
            if( m_CurrentPage.WizardPageParent != this )
            {
              m_CurrentPage.WizardPageParent = this;
            }

            // show page custom data
            if( m_CurrentPage.HeaderImage != null )
            {
              imgHeader.Image = m_CurrentPage.HeaderImage;
            }
            else
            {
              if( m_CurrentPage.ImageList != null &&
            m_CurrentPage.ImageIndex >= 0 &&
            m_CurrentPage.ImageIndex < m_CurrentPage.ImageList.Images.Count )
              {
            imgHeader.Image = m_CurrentPage.ImageList.Images[ m_CurrentPage.ImageIndex ];
              }
              else
              {
            imgHeader.Image = null;
              }
            }

            lblTitle.Text = m_CurrentPage.Title;
            lblDescription.Text = m_CurrentPage.Description;

            m_CurrentPage.Changed += new EventHandler( WizardPageAttributesChanged );

            // if Welcome page then link it ot pnlMain otherwise to pnlBody
            if( m_CurrentPage.WelcomePage == false )
            {
              pnlMain.Controls.AddRange( new System.Windows.Forms.Control[]{ pnlBody, pnlHeader } );

              // fix width and height of body panel
              pnlBody.Width = pnlMain.Width - 16;
              pnlBody.Height = pnlMain.Height - pnlHeader.Height - 8;

              // fix page control resize
              if( m_CurrentPage.Width != pnlBody.Width || m_CurrentPage.Height != pnlBody.Height )
              {
            m_CurrentPage.Width = pnlBody.Width;
            m_CurrentPage.Height = pnlBody.Height;
              }

              pnlBody.Controls.Add( m_CurrentPage );
              pnlBody.Controls[0].Focus();
            }
            else
            {
              // fix page control resize
              if( m_CurrentPage.Width != pnlMain.Width || m_CurrentPage.Height != pnlMain.Height )
              {
            m_CurrentPage.Size = pnlMain.Size;
              }

              pnlMain.Controls.Add( m_CurrentPage );
              pnlMain.Controls[0].Focus();
            }

            // if current page has indicator that it is a Finish Page then Show
            // Finish Button
            if( m_CurrentPage.FinishPage == true )
            {
              m_eButtons |= WizardsButtons.Finish;
            }
            else // otherwise do not show Finish Button
            {
              m_eButtons &= (~WizardsButtons.Finish);
            }

            // modify buttons states
            ChangeButtonsStates();
              }
              else // in case of empty Collection show standard "work page" view of control
              {
            pnlMain.Controls.AddRange( new System.Windows.Forms.Control[]{ pnlBody, pnlHeader } );
              }

              pnlBody.ResumeLayout();
              pnlMain.ResumeLayout();

              OnPageShown();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Show Wizard Page. m_iShowIndex is identifier of page which
        /// Wizard control must show
        /// </summary>
        protected void ShowWizardPage()
        {
            // do not show one page twice
            if (m_iShowIndex == m_iLastShown)
            {
                return;
            }

            pnlMain.SuspendLayout();
            pnlBody.SuspendLayout();

            pnlMain.Controls.Clear();
            pnlBody.Controls.Clear();

            // check if control has any pages
            if (m_pages.Count > 0)
            {
                m_pages.Sort();

                // check m_iShowIndex
                if (m_iShowIndex < 0)
                {
                    m_iShowIndex = 0;
                }
                if (m_iShowIndex >= m_pages.Count)
                {
                    m_iShowIndex = m_pages.Count - 1;
                }

                m_CurrentPage = m_pages[m_iLastShown = m_iShowIndex];

                // set page parent correctly in case when is something wrong
                if (m_CurrentPage.WizardPageParent != this)
                {
                    m_CurrentPage.WizardPageParent = this;
                }

                // show page custom data
                if (m_CurrentPage.HeaderImage != null)
                {
                    imgHeader.Image = m_CurrentPage.HeaderImage;
                }
                else
                {
                    if (m_CurrentPage.ImageList != null &&
                        m_CurrentPage.ImageIndex >= 0 &&
                        m_CurrentPage.ImageIndex < m_CurrentPage.ImageList.Images.Count)
                    {
                        imgHeader.Image = m_CurrentPage.ImageList.Images[m_CurrentPage.ImageIndex];
                    }
                    else
                    {
                        imgHeader.Image = null;
                    }
                }

                lblTitle.Text       = m_CurrentPage.Title;
                lblDescription.Text = m_CurrentPage.Description;

                m_CurrentPage.Changed += new EventHandler(WizardPageAttributesChanged);

                // if Welcome page then link it ot pnlMain otherwise to pnlBody
                if (m_CurrentPage.WelcomePage == false)
                {
                    pnlMain.Controls.AddRange(new System.Windows.Forms.Control[] { pnlBody, pnlHeader });

                    // fix width and height of body panel
                    pnlBody.Width  = pnlMain.Width - 16;
                    pnlBody.Height = pnlMain.Height - pnlHeader.Height - 8;

                    // fix page control resize
                    if (m_CurrentPage.Width != pnlBody.Width || m_CurrentPage.Height != pnlBody.Height)
                    {
                        m_CurrentPage.Width  = pnlBody.Width;
                        m_CurrentPage.Height = pnlBody.Height;
                    }

                    pnlBody.Controls.Add(m_CurrentPage);
                    pnlBody.Controls[0].Focus();
                }
                else
                {
                    // fix page control resize
                    if (m_CurrentPage.Width != pnlMain.Width || m_CurrentPage.Height != pnlMain.Height)
                    {
                        m_CurrentPage.Size = pnlMain.Size;
                    }

                    pnlMain.Controls.Add(m_CurrentPage);
                    pnlMain.Controls[0].Focus();
                }

                // if current page has indicator that it is a Finish Page then Show
                // Finish Button
                if (m_CurrentPage.FinishPage == true)
                {
                    m_eButtons |= WizardsButtons.Finish;
                }
                else // otherwise do not show Finish Button
                {
                    m_eButtons &= (~WizardsButtons.Finish);
                }

                // modify buttons states
                ChangeButtonsStates();
            }
            else // in case of empty Collection show standard "work page" view of control
            {
                pnlMain.Controls.AddRange(new System.Windows.Forms.Control[] { pnlBody, pnlHeader });
            }

            pnlBody.ResumeLayout();
            pnlMain.ResumeLayout();

            OnPageShown();
        }