If you do not want to use the wizard control in. net webparts, you can design a simple one. I designed a simple wizard framework with the following ideas:
1. First, there will be a wizard class. I call it Navigation. The wizard class has a container that contains all the forms in this wizard. The wizard provides all the core functions in the Wizard framework, such as start, next step, previous step, and finish.
2. design a form base class, which is currently called BaseForm. all wizard forms inherit from this base class. Some hooks must be reserved for the base class (in C #, they can be designed as virtual or abstract, and c ++ can be virtual ), perform the specific form logic for each derived subclass form. For example, you need to update the Form title and process the business logic. In addition, the window contains some wizard controls (Next, Previou, Finish, Cancel ). Finally, you must associate Navigation with the form base class.
3. Continue all the wizard forms from BaseForm and implement the Hook method of the base class.
The following is the main framework code written in C:
public class Navigation{ public List<BaseForm> container; public int currentIndex; public void Start() {currentIndex = 0; container[currentIndex].Show();} public void Finish() {currentIndex = container.Count-1;} public void Next(); public void Previous(); public Navigation() { currentIndex = 0; container = new List<BaseForm>(); } public void InitNavContainer() { // TODO: Add your wizard forms step by step container.Add(.....) } public int IsHeadForm() { return (currentIndex == 0); } public int IsTailForm() { return (currentIndex == container.Count - 1); }}
Below is the form base class:
1: public class BaseForm : Form
2: {
3: public abstract void DoSomething();
4: public Button btnNext;
5: public Button btnPrevious;
6: public Button btnFinish;
7: public Button btnCancel;
8:
9: public Navigation navigation;
10:
11: public BaseForm(Navigation _navigation)
12: {
13: navigation = _navigation;
14: }
15:
16: public void OnNext()
17: {
18: navigation.Next();
19: }
20:
21: ........
22: }
The subform code is very simple, so the code is directly written without the compile compiler. C # sucks.