Exemplo n.º 1
0
 /// <devdoc>
 /// Registers a panel for use in this wizard.
 /// </devdoc>
 internal void RegisterPanel(WizardPanel panel)
 {
     if (!TaskPanel.Controls.Contains(panel))
     {
         panel.Dock = DockStyle.Fill;
         panel.SetParentWizard(this);
         panel.Hide();
         TaskPanel.Controls.Add(panel);
     }
 }
Exemplo n.º 2
0
 /// <devdoc>
 /// Goes to the back panel in the wizard.
 /// </devdoc>
 public void PreviousPanel()
 {
     if (_panelHistory.Count > 1)
     {
         WizardPanel currentPanel = _panelHistory.Pop();
         WizardPanel backPanel    = _panelHistory.Peek();
         currentPanel.OnPrevious();
         currentPanel.Hide();
         OnPanelChanging(new WizardPanelChangingEventArgs(currentPanel));
         ShowPanel(backPanel);
     }
 }
Exemplo n.º 3
0
        /// <devdoc>
        /// Initializes a WizardForm to use an ordered array of panels.
        /// </devdoc>
        protected void SetPanels(WizardPanel[] panels)
        {
            if ((panels != null) && (panels.Length > 0))
            {
                RegisterPanel(panels[0]);
                _initialPanel = panels[0];

                for (int i = 0; i < panels.Length - 1; i++)
                {
                    RegisterPanel(panels[i + 1]);
                    panels[i].NextPanel = panels[i + 1];
                }
            }
        }
Exemplo n.º 4
0
        /// <devdoc>
        /// Goes to the next panel in the wizard.
        /// </devdoc>
        public void NextPanel()
        {
            WizardPanel currentPanel = _panelHistory.Peek();

            if (currentPanel.OnNext())
            {
                currentPanel.Hide();
                WizardPanel nextPanel = currentPanel.NextPanel;
                if (nextPanel != null)
                {
                    RegisterPanel(nextPanel);
                    _panelHistory.Push(nextPanel);
                    OnPanelChanging(new WizardPanelChangingEventArgs(currentPanel));
                    ShowPanel(nextPanel);
                }
            }
        }
Exemplo n.º 5
0
        /// <devdoc>
        /// Click event handler for the Finish button.
        /// </devdoc>
        protected virtual void OnFinishButtonClick(object sender, System.EventArgs e)
        {
            WizardPanel currentPanel = _panelHistory.Peek();

            if (currentPanel.OnNext())
            {
                // Call OnComplete for every panel on the stack
                WizardPanel[] panels = _panelHistory.ToArray();
                Array.Reverse(panels);
                foreach (WizardPanel panel in panels)
                {
                    panel.OnComplete();
                }

                DialogResult = DialogResult.OK;
                Close();
            }
        }
Exemplo n.º 6
0
        /// <devdoc>
        /// Shows the panel specified by the given index.
        /// </devdoc>
        private void ShowPanel(WizardPanel panel)
        {
            if (_panelHistory.Count == 1)
            {
                // If we're on the first panel, disable the back button
                PreviousButton.Enabled = false;
            }
            else
            {
                // Otherwise, enable it
                PreviousButton.Enabled = true;
            }

            if (panel.NextPanel == null)
            {
                // If we're on the last panel, change the button text
                NextButton.Enabled = false;
            }
            else
            {
                NextButton.Enabled = true;
            }

            // Show the specified panel
            panel.Show();

            // Set the description and caption of the task bar
            AccessibleDescription = panel.Caption;
            CaptionLabel.Text     = panel.Caption;

            if (IsHandleCreated)
            {
                // Refresh the screen
                Invalidate();
            }

            // Focus the newly shown panel
            panel.Focus();
        }
 /// <devdoc>
 /// </devdoc>
 public WizardPanelChangingEventArgs(WizardPanel currentPanel)
 {
     _currentPanel = currentPanel;
 }
 /// <devdoc>
 /// </devdoc>
 public WizardPanelChangingEventArgs(WizardPanel currentPanel)
 {
     _currentPanel = currentPanel;
 }
Exemplo n.º 9
0
        /// <devdoc>
        /// Shows the panel specified by the given index.
        /// </devdoc>
        private void ShowPanel(WizardPanel panel)
        {
            if (_panelHistory.Count == 1)
            {
                // If we're on the first panel, disable the back button
                PreviousButton.Enabled = false;
            }
            else
            {
                // Otherwise, enable it
                PreviousButton.Enabled = true;
            }

            if (panel.NextPanel == null)
            {
                // If we're on the last panel, change the button text
                NextButton.Enabled = false;
            }
            else
            {
                NextButton.Enabled = true;
            }

            // Show the specified panel
            panel.Show();

            // Set the description and caption of the task bar
            AccessibleDescription = panel.Caption;
            CaptionLabel.Text = panel.Caption;

            if (IsHandleCreated)
            {
                // Refresh the screen
                Invalidate();
            }

            // Focus the newly shown panel
            panel.Focus();
        }
Exemplo n.º 10
0
        /// <devdoc>
        /// Initializes a WizardForm to use an ordered array of panels.
        /// </devdoc>
        protected void SetPanels(WizardPanel[] panels)
        {
            if ((panels != null) && (panels.Length > 0))
            {
                RegisterPanel(panels[0]);
                _initialPanel = panels[0];

                for (int i = 0; i < panels.Length - 1; i++)
                {
                    RegisterPanel(panels[i + 1]);
                    panels[i].NextPanel = panels[i + 1];
                }
            }
        }
Exemplo n.º 11
0
 /// <devdoc>
 /// Registers a panel for use in this wizard.
 /// </devdoc>
 internal void RegisterPanel(WizardPanel panel)
 {
     if (!TaskPanel.Controls.Contains(panel))
     {
         panel.Dock = DockStyle.Fill;
         panel.SetParentWizard(this);
         panel.Hide();
         TaskPanel.Controls.Add(panel);
     }
 }