예제 #1
0
        /// <summary>
        /// Invoked when <see cref="WizardNavigator.NextButton"/> is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NextButton_Click(object sender, EventArgs e)
        {
            try
            {
                ((IWizardPage)(pageControls[ActivePageIndex])).OnNext();

                if (ActivePageIndex < pageControls.Count - 1 && (WizardNavigator.NextButton.Text == "Next" || WizardNavigator.NextButton.Text == "Start"))
                {
                    // Hide current page
                    pageControls[ActivePageIndex].Visible = false;

                    ActivePageIndex++;

                    // Initialize the next page
                    if (!((IWizardPage)(pageControls[ActivePageIndex])).Initialized)
                    {
                        ((IWizardPage)(pageControls[ActivePageIndex])).Initialize();
                    }

                    // Show next page
                    pageControls[ActivePageIndex].Visible = true;
                    WizardNavigator.UpdateState(defaultNavigatorStates[ActivePageIndex]);
                }
                else if (WizardNavigator.NextButton.Text == "Finish")
                {
                    FinishClicked?.Invoke();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                throw;
            }
        }
예제 #2
0
        /// <summary>
        /// Loads the first page and begins the wizard.
        /// </summary>
        public void BeginWizard()
        {
            // Initialize first page
            if (!((IWizardPage)(pageControls[0])).Initialized)
            {
                ((IWizardPage)(pageControls[0])).Initialize();
            }

            // Open first page
            pageControls[0].Visible = true;
            WizardNavigator.UpdateState(defaultNavigatorStates[0]);
        }
예제 #3
0
        /// <summary>
        /// Invoked when <see cref="WizardNavigator.BackButton"/> is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BackButton_Click(object sender, EventArgs e)
        {
            if (ActivePageIndex > 0)
            {
                // Hide current page
                pageControls[ActivePageIndex].Visible = false;

                ActivePageIndex--;

                // Initialize the next page
                if (!((IWizardPage)(pageControls[ActivePageIndex])).Initialized)
                {
                    ((IWizardPage)(pageControls[ActivePageIndex])).Initialize();
                }

                // Show previous page
                pageControls[ActivePageIndex].Visible = true;
                WizardNavigator.UpdateState(defaultNavigatorStates[ActivePageIndex]);
            }
        }
예제 #4
0
 /// <summary>
 /// Invoked when <see cref="WizardNavigator.BackButton"/> is clicked
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BackButton_Click(object sender, EventArgs e)
 {
     if (ActivePageIndex > 0)
     {
         ActivePageIndex--;
         for (int i = 1; i < Controls.Count; i++)
         {
             if (i == ActivePageIndex + 1)
             {
                 Controls[i].Visible = true;
             }
             else
             {
                 Controls[i].Visible = false;
             }
         }
         WizardNavigator.UpdateState(defaultNavigatorStates[ActivePageIndex + 1]);
         if (!((IWizardPage)(this.Controls[ActivePageIndex + 1])).Initialized)
         {
             ((IWizardPage)(this.Controls[ActivePageIndex + 1])).Initialize();
         }
     }
 }
예제 #5
0
 /// <summary>
 /// Invoked when <see cref="WizardNavigator.NextButton"/> is clicked
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void NextButton_Click(object sender, EventArgs e)
 {
     try
     {
         ((IWizardPage)(this.Controls[ActivePageIndex + 1])).OnNext();
         if (ActivePageIndex < Controls.Count - 1 && WizardNavigator.NextButton.Text == "Next >" || WizardNavigator.NextButton.Text == "Start >")
         {
             ActivePageIndex++;
             for (int i = 1; i < Controls.Count; i++)
             {
                 if (i == ActivePageIndex + 1)
                 {
                     Controls[i].Visible = true;
                 }
                 else
                 {
                     Controls[i].Visible = false;
                 }
             }
             WizardNavigator.UpdateState(defaultNavigatorStates[ActivePageIndex + 1]);
             if (!((IWizardPage)(this.Controls[ActivePageIndex + 1])).Initialized)
             {
                 ((IWizardPage)(this.Controls[ActivePageIndex + 1])).Initialize();
             }
         }
         else if (WizardNavigator.NextButton.Text == "Finish")
         {
             FinishClicked?.Invoke();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
         throw;
     }
 }
예제 #6
0
 /// <summary>
 /// Loads the first page and begins the wizard.
 /// </summary>
 public void BeginWizard()
 {
     Controls[1].Visible = true;
     WizardNavigator.UpdateState(defaultNavigatorStates[1]);
 }