1 //------------------------------------------------------------------------------
2 // <copyright file="WizardPanel.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
7 // @backupOwner Microsoft
8 //------------------------------------------------------------------------------
11 using System.Collections;
12 using System.ComponentModel;
13 using System.ComponentModel.Design;
14 using System.Diagnostics;
16 using System.Windows.Forms;
18 namespace System.Web.UI.Design.WebControls.Util
21 /// Represents a single step in a wizard.
22 /// WizardPanels are contained within a single WizardForm.
24 internal class WizardPanel : System.Windows.Forms.UserControl
27 private WizardForm _parentWizard;
28 private string _caption;
29 private WizardPanel _nextPanel;
30 private bool _needsToInvalidate;
33 /// Creates a new WizardPanel.
40 /// The caption to be shown on the WizardForm
55 if (_parentWizard != null)
57 _parentWizard.Invalidate();
61 _needsToInvalidate = true;
67 /// The panel to go to when the Next button is clicked. This can be set dynamically in
68 /// the OnNext() event to customize the order in which panels are used.
70 public WizardPanel NextPanel
79 Debug.Assert(_parentWizard != null);
80 if (_parentWizard != null)
82 _parentWizard.RegisterPanel(_nextPanel);
88 /// This method is called when the wizard's Finish button is clicked.
89 /// It is called once for each wizard panel on the panel stack, in the order from the first panel to the last (current) panel.
91 protected internal virtual void OnComplete()
96 /// Runs when the next button is clicked while this panel is showing.
97 /// Returns true if the wizard should proceed to the next panel.
99 public virtual bool OnNext()
105 /// Runs when the previous button of the parent wizard form is clicked while this panel is active
107 public virtual void OnPrevious()
113 internal void SetParentWizard(WizardForm parent)
115 _parentWizard = parent;
116 if ((_parentWizard != null) && _needsToInvalidate)
118 _parentWizard.Invalidate();
119 _needsToInvalidate = false;