Exemple #1
0
 protected void RaiseChanged(WizardPageBase value)
 {
     if (Changed != null)
     {
         Changed(value, EventArgs.Empty);
     }
 }
Exemple #2
0
            public int Compare(object x, object y)
            {
                WizardPageBase page1 = ( WizardPageBase )x;
                WizardPageBase page2 = ( WizardPageBase )y;

                return((page1.Index > page2.Index) ? 1 :
                       ((page1.Index < page2.Index) ? -1 : 0));
            }
Exemple #3
0
 private void OnAddPageClick( object sender, EventArgs e )
 {
   WizardForm ctrl = ( WizardForm )Control;
   WizardPageBase page = new WizardPageBase();
   ctrl.Pages.Add( page );
   
   IDesignerHost host = (IDesignerHost)GetService( typeof( IDesignerHost ) );
   if( host != null ) host.Container.Add( page );
 }
Exemple #4
0
        /// <summary>
        /// Special Method Used only In Designer Control Mode
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        internal void WizardPageAttributesChanged(object sender, EventArgs e)
        {
            WizardPageBase page = ( WizardPageBase )sender;

            // remove designer event first
            page.Changed -= new EventHandler(WizardPageAttributesChanged);

            m_iLastShown = -1;
            ShowWizardPage();
        }
Exemple #5
0
            public void Insert(int index, WizardPageBase value)
            {
                value.WizardPageParent = m_parent;
                InnerList.Insert(index, value);

                if (value.Index < 0)
                {
                    value.Index = index;
                }

                RaiseChanged(value);
            }
Exemple #6
0
            protected override void OnSetComplete(int index, object oldValue, object newValue)
            {
                WizardPageBase page = ( WizardPageBase )newValue;

                page.WizardPageParent = m_parent;
                if (page.Index < 0)
                {
                    page.Index = index;
                }

                base.OnSetComplete(index, oldValue, page);

                RaiseChanged(page);
            }
Exemple #7
0
            protected override void OnInsertComplete(int index, object value)
            {
                WizardPageBase page = ( WizardPageBase )value;

                page.WizardPageParent = m_parent;
                if (page.Index < 0)
                {
                    page.Index = index;
                }

                base.OnInsertComplete(index, page);

                RaiseChanged(page);
            }
Exemple #8
0
            public int Add(WizardPageBase value)
            {
                if (Contains(value) == true)
                {
                    return(IndexOf(value));
                }

                value.WizardPageParent = m_parent;
                int index = InnerList.Add(value);

                if (value.Index < 0)
                {
                    value.Index = index;
                }

                RaiseChanged(value);

                return(index);
            }
Exemple #9
0
        /// <summary>
        /// Event Handler which raised on Pages Collection changes
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void PagesCollectionChanged(object sender, EventArgs e)
        {
            if (m_pages.Count > 0)
            {
                if (sender is WizardPageBase)
                {
                    WizardPageBase page = ( WizardPageBase )sender;

                    // remove old handlers
                    page.ControlAdded   -= new ControlEventHandler(AttachControlEvents);
                    page.ControlRemoved -= new ControlEventHandler(DetachControlEvents);

                    // add them again
                    page.ControlAdded   += new ControlEventHandler(AttachControlEvents);
                    page.ControlRemoved += new ControlEventHandler(DetachControlEvents);
                }

                m_iLastShown = -1;
                ShowWizardPage();
            }
        }
Exemple #10
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 |= TWizardsButtons.Finish;
                }
                else // otherwise do not show Finish Button
                {
                    m_eButtons &= (~TWizardsButtons.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();
        }
Exemple #11
0
 public EventNextArgs(WizardPageBase page, int step) : this( page )
 {
     m_iStep = step;
 }
Exemple #12
0
 public EventNextArgs(WizardPageBase page)
 {
     m_page = page;
 }
 public void AddRange( WizardPageBase[] array )
 {
     foreach( WizardPageBase page in array )
     {
       Add( page );
     }
 }
 public bool Contains( WizardPageBase value )
 {
     return InnerList.Contains( value );
 }
 public int IndexOf( WizardPageBase value )
 {
     return InnerList.IndexOf( value );
 }
        /// <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 |= TWizardsButtons.Finish;
            }
            else // otherwise do not show Finish Button
            {
              m_eButtons &= (~TWizardsButtons.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();
        }
            public void Insert( int index, WizardPageBase value )
            {
                value.WizardPageParent = m_parent;
                InnerList.Insert( index, value );

                if( value.Index < 0 )
                  value.Index = index;

                RaiseChanged( value );
            }
Exemple #18
0
 public int IndexOf(WizardPageBase value)
 {
     return(InnerList.IndexOf(value));
 }
Exemple #19
0
 public bool Contains(WizardPageBase value)
 {
     return(InnerList.Contains(value));
 }
 public EventNextArgs( WizardPageBase page, int step )
     : this(page)
 {
     m_iStep = step;
 }
 public void Remove( WizardPageBase value )
 {
     InnerList.Remove( value );
     RaiseChanged();
 }
            public int Add( WizardPageBase value )
            {
                if( Contains( value ) == true )
                {
                  return IndexOf( value );
                }

                value.WizardPageParent = m_parent;
                int index = InnerList.Add( value );

                if( value.Index < 0 )
                  value.Index = index;

                RaiseChanged( value );

                return index;
            }
Exemple #23
0
 public void Remove(WizardPageBase value)
 {
     InnerList.Remove(value);
     RaiseChanged();
 }
 public EventNextArgs( WizardPageBase page )
 {
     m_page = page;
 }
 protected void RaiseChanged( WizardPageBase value )
 {
     if( Changed != null )
     {
       Changed( value, EventArgs.Empty );
     }
 }