Click here to Skip to main content
15,887,676 members
Articles / Programming Languages / C#

TSWizard - A Wizard Framework for .NET

Rate me:
Please Sign up or sign in to vote.
4.86/5 (55 votes)
26 May 2003BSD17 min read 463K   4.6K   209  
Provides a framework for creating wizards for use in your .NET applications
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;

using System.Windows.Forms;


namespace TSWizardDemo
{
	public class Step5 : TSWizards.BaseStep
	{
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.CheckBox runAgain;
		private System.ComponentModel.IContainer components = null;

		public Step5()
		{
			// This call is required by the Windows Form Designer.
			InitializeComponent();

			// TODO: Add any initialization after the InitializeComponent call
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.label1 = new System.Windows.Forms.Label();
			this.runAgain = new System.Windows.Forms.CheckBox();
			this.SuspendLayout();
			// 
			// Description
			// 
			this.Description.Text = "Your order is complete!";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(16, 64);
			this.label1.Name = "label1";
			this.label1.TabIndex = 1;
			this.label1.Text = "ENJOY!";
			// 
			// runAgain
			// 
			this.runAgain.Location = new System.Drawing.Point(24, 160);
			this.runAgain.Name = "runAgain";
			this.runAgain.Size = new System.Drawing.Size(208, 32);
			this.runAgain.TabIndex = 1;
			this.runAgain.Text = "Would you like to run the Wait On Us order wizard again?";
			// 
			// Step5
			// 
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.Description,
																		  this.runAgain,
																		  this.label1});
			this.IsFinished = true;
			this.Name = "Step5";
			this.NextStep = "FINISHED";
			this.StepTitle = "Done!";
			this.ResumeLayout(false);

		}
		#endregion

		protected override void OnFinish()
		{
			if( runAgain.Checked )
			{
				string moveTo;
				
				Step1 step1 = Wizard.GetStep("Step1") as Step1;

				if( !step1.NoShowWelcomeAgain )
					moveTo = "Step1";
				else
					moveTo = "Step2";
				
				Wizard.ResetSteps();

				Wizard.MoveTo(moveTo);

				IsFinished = true;
			}
			else
			{
				base.OnFinish();
			}
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The BSD License


Written By
Software Developer (Senior) InfoPlanIT, LLC
United States United States
James has been programming in C/C++ since 1998, and grew fond of databases in 1999. His latest interest has been in C# and .NET where he has been having fun writing code starting when .NET v1.0 was in its first beta.

He is currently a senior developer and consultant for InfoPlanIT, a small international consulting company that focuses on custom solutions and business intelligence applications.

He was previously employed by ComponentOne where he was a Product Manager for the ActiveReports, Data Dynamics Reports, and ActiveAnalysis products.

Code contained in articles where he is the sole author is licensed via the new BSD license.

Comments and Discussions