Example #1
0
 protected void RaiseChanged(WizardPageBase value)
 {
     if (Changed != null)
     {
         Changed(value, EventArgs.Empty);
     }
 }
Example #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));
            }
Example #3
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();
        }
Example #4
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);
            }
Example #5
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);
            }
        }
Example #6
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);
            }
Example #7
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);
            }
        /// <summary>
        /// Custom Drawing of Wizard Page in IDE Designer
        /// </summary>
        /// <param name="pe"></param>
        protected override void OnPaintAdornments(System.Windows.Forms.PaintEventArgs pe)
        {
            base.OnPaintAdornments(pe);

            Graphics g = pe.Graphics;

            WizardPageBase page = Control as WizardPageBase;

            if (page == null)
            {
                page = Component as WizardPageBase;
            }

            if (page != null)
            {
                WizardForm parent = page.WizardPageParent;

                string strPos;

                if (page != null && parent != null)
                {
                    strPos = (parent.Pages.IndexOf(page) + 1).ToString();
                }
                else // if something wrong then simply show MINUS
                {
                    strPos = "-";
                    if (page == null)
                    {
                        strPos += "p";
                    }
                    if (parent == null)
                    {
                        strPos += "P";
                    }
                }

                g.FillRectangle(m_brushBack, m_rect);

                StringFormat frmString = new StringFormat();
                frmString.Alignment     = StringAlignment.Center;
                frmString.LineAlignment = StringAlignment.Center;

                g.DrawString(strPos, m_font, m_brushText, m_rect, frmString);
            }
        }
Example #9
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);
            }
Example #10
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();
            }
        }
        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 );
        }
Example #12
0
 public int IndexOf(WizardPageBase value)
 {
     return(InnerList.IndexOf(value));
 }
Example #13
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 );
            }
Example #14
0
 public bool Contains( WizardPageBase value )
 {
     return InnerList.Contains( value );
 }
Example #15
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;
            }
Example #16
0
 public EventNextArgs(WizardPageBase page)
 {
     m_page = page;
 }
Example #17
0
 public void Remove(WizardPageBase value)
 {
     InnerList.Remove(value);
     RaiseChanged();
 }
Example #18
0
 public EventNextArgs( WizardPageBase page )
 {
     m_page = page;
 }
Example #19
0
 public EventNextArgs( WizardPageBase page, int step )
     : this(page)
 {
     m_iStep = step;
 }
Example #20
0
 public EventNextArgs(WizardPageBase page, int step) : this( page )
 {
     m_iStep = step;
 }
Example #21
0
 public void AddRange( WizardPageBase[] array )
 {
     foreach( WizardPageBase page in array )
     {
       Add( page );
     }
 }
Example #22
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();
        }
Example #23
0
 public int IndexOf( WizardPageBase value )
 {
     return InnerList.IndexOf( value );
 }
Example #24
0
 protected void RaiseChanged( WizardPageBase value )
 {
     if( Changed != null )
     {
       Changed( value, EventArgs.Empty );
     }
 }
Example #25
0
 public void Remove( WizardPageBase value )
 {
     InnerList.Remove( value );
     RaiseChanged();
 }
Example #26
0
 public bool Contains(WizardPageBase value)
 {
     return(InnerList.Contains(value));
 }
Example #27
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();
        }
Example #28
0
        /// <summary>
        /// Custom Drawing of Wizard Page in IDE Designer
        /// </summary>
        /// <param name="pe"></param>
        protected override void OnPaintAdornments(System.Windows.Forms.PaintEventArgs pe)
        {
            base.OnPaintAdornments(pe);

            Graphics  g = pe.Graphics;
            Rectangle rect;// = pe.ClipRectangle;

            WizardPageBase page = Control as WizardPageBase;

            if (page == null)
            {
                page = Component as WizardPageBase;
            }

            WizardForm parent = (page != null) ? page.WizardPageParent : null;

            string strPos;

            if (page != null && parent != null)
            {
                strPos = (parent.Pages.IndexOf(page) + 1).ToString();
            }
            else // if something wrong then simply show MINUS
            {
                strPos = "-";
                if (page == null)
                {
                    strPos += "p";
                }
                if (parent == null)
                {
                    strPos += "P";
                }
            }

            g.FillRectangle(m_brushBack, m_rect);

            StringFormat frmString = new StringFormat();

            frmString.Alignment     = StringAlignment.Center;
            frmString.LineAlignment = StringAlignment.Center;

            g.DrawString(strPos, m_font, m_brushText, m_rect, frmString);

            if (parent != null)
            {
                rect = parent.GetCurrentPageRect();
                if (rect.Width % 8 > 0)
                {
                    rect.Width = (int)(rect.Width / 8) * 8;
                }

                if (rect.Height % 8 > 0)
                {
                    rect.Height = (int)(rect.Height / 8) * 8;
                }

                if (page != null && page.WelcomePage == false && m_bShowLines == true)
                {
                    Point[] pnt = new Point[]
                    {
                        new Point(new Size(rect.X + 24, rect.Y + 8)),
                        new Point(new Size(rect.X + 24, rect.Bottom - 8)),
                        new Point(new Size(rect.X + 40, rect.Bottom - 8)),
                        new Point(new Size(rect.X + 40, rect.Y + 8)),
                        new Point(new Size(rect.X + 56, rect.Y + 8)),
                        new Point(new Size(rect.X + 56, rect.Bottom - 8)),

                        new Point(new Size(rect.Right - 56, rect.Bottom - 8)),
                        new Point(new Size(rect.Right - 56, rect.Y + 8)),
                        new Point(new Size(rect.Right - 40, rect.Y + 8)),
                        new Point(new Size(rect.Right - 40, rect.Bottom - 8)),
                        new Point(new Size(rect.Right - 24, rect.Bottom - 8)),
                        new Point(new Size(rect.Right - 24, rect.Y + 8)),

                        new Point(new Size(rect.X + 24, rect.Y + 8)),
                        new Point(new Size(rect.X + 24, rect.Bottom - 8)),
                        new Point(new Size(rect.Right - 24, rect.Bottom - 8))
                    };

                    Pen pen = new Pen(Brushes.Black);
                    pen.DashStyle = DashStyle.DashDotDot;
                    g.DrawLines(pen, pnt);
                    pen.Dispose();
                }
            }
        }