Example #1
0
        private void OnFormShown(object sender, EventArgs e)
        {
            WizardPageBase firstPage = this.SelectedPage;

            if (firstPage != null)
            {
                firstPage.OnBeforeDisplay(EventArgs.Empty);
                firstPage.OnAfterDisplay(EventArgs.Empty);
            }
        }
Example #2
0
 public virtual void GoNext()
 {
     //thread safe call
     if (this.InvokeRequired)
     {
         VoidCallback callback = new VoidCallback(GoNext);
         this.Invoke(callback);
     }
     else
     {
         if (this.SelectedPage != null)
         {
             this.disabled = true;
             this.RedrawButtons();
             this.Cursor = Cursors.WaitCursor;
             try
             {
                 WizardPageBase  selectedPage = this.SelectedPage;
                 CancelEventArgs args         = new CancelEventArgs();
                 selectedPage.OnBeforeMoveNext(args);
                 if (!args.Cancel)
                 {
                     if (selectedPage.NextPage == null)
                     {
                         this.OnFinish(EventArgs.Empty);
                     }
                     else
                     {
                         WizardPageBase nextPage = selectedPage.NextPage;
                         if (nextPage != null)
                         {
                             nextPage.OnBeforeDisplay(EventArgs.Empty);
                         }
                         this.SelectedPage = nextPage;
                         if (nextPage != null)
                         {
                             nextPage.OnAfterDisplay(EventArgs.Empty);
                         }
                     }
                 }
             }
             finally
             {
                 this.disabled = false;
                 this.RedrawButtons();
                 this.Cursor = Cursors.Default;
             }
         }
     }
 }
Example #3
0
        private WizardPageBase[] GetConnectedPages(WizardPageBase currentPage, bool forwardDirection)
        {
            ArrayList list = new ArrayList();

            foreach (Control ctrl in base.Controls)
            {
                if (ctrl is WizardPageBase)
                {
                    WizardPageBase page = (WizardPageBase)ctrl;
                    if (((page.NextPage == currentPage) && forwardDirection) || ((page.PreviousPage == currentPage) && !forwardDirection))
                    {
                        list.Add(page);
                    }
                }
            }
            return((WizardPageBase[])list.ToArray(typeof(WizardPageBase)));
        }
Example #4
0
        public void LinkPages()
        {
            WizardPageBase prevPage = null;

            foreach (Control ctrl in this.Controls)
            {
                WizardPageBase page = ctrl as WizardPageBase;
                if (page != null)
                {
                    page.PreviousPage = prevPage;
                    if (prevPage != null)
                    {
                        prevPage.NextPage = page;
                    }
                    prevPage = page;
                }
            }
        }
Example #5
0
 public virtual void GoBack()
 {
     //thread safe call
     if (this.InvokeRequired)
     {
         VoidCallback callback = new VoidCallback(GoBack);
         this.Invoke(callback);
     }
     else
     {
         this.disabled = true;
         this.RedrawButtons();
         this.Cursor = Cursors.WaitCursor;
         try
         {
             WizardPageBase  selectedPage = this.SelectedPage;
             CancelEventArgs args         = new CancelEventArgs();
             selectedPage.OnBeforeMoveBack(args);
             if (!args.Cancel)
             {
                 WizardPageBase prevPage = selectedPage.PreviousPage;
                 this.SelectedPage = prevPage;
                 if (prevPage != null)
                 {
                     prevPage.OnAfterDisplay(EventArgs.Empty);
                 }
             }
         }
         finally
         {
             this.disabled = false;
             this.RedrawButtons();
             this.Cursor = Cursors.Default;
         }
     }
 }
Example #6
0
 public void SetPagePair(WizardPageBase firstPage, WizardPageBase secondPage)
 {
     firstPage.NextPage      = secondPage;
     secondPage.PreviousPage = firstPage;
 }
Example #7
0
 public WizardPageBase[] GetPagesWithPreviousPage(WizardPageBase previousPage)
 {
     return(this.GetConnectedPages(previousPage, false));
 }
Example #8
0
 public WizardPageBase[] GetPagesWithNextPage(WizardPageBase nextPage)
 {
     return(this.GetConnectedPages(nextPage, true));
 }