仓酷云 发表于 2015-1-16 22:42:57

ASP.NET编程:C#计划的一个导游程序(Wizard)框架

J2EE比较成熟一点,一些比较出名的企业应用软件都是基于J2EE的。以后的发展就不好说了。不过java比较烦,学.net的话,微软把很多工具都封装好了,学起来可能容易一点。程序|计划在实际的软件中,常常能够看到一些导游(Wizard)的存在,怎样给本人的使用程序完成一个导游呢?
上面给出一个利用面向工具的头脑计划出来的使用程序导游框架,固然很复杂,但但愿能给人匡助。
个中有三个对照关头的类,一个是导游窗体要搜集的信息封装成的类Information,一个是一切导游窗体都要承继的窗体基类frmBase,另有一个就是最关头的类,导游把持类WizardController。
有了基类frmBase,计划一个子类窗体十分复杂,只需从frmBase类中派生一个新窗体,计划完用户界面以后重写其UpdateInfo()办法便可。
一切代码(VS2003版)以下,普通易懂,不再做申明:
Information类:
usingSystem;
namespaceWizard
{
///<summary>
///Information的择要申明。
///</summary>
publicclassInformation
{
publicInformation()
{
//
//TODO:在此处增加机关函数逻辑
//
}
//姓名
publicstringName="";
//性别
publicboolIsMale=true;
//学历
publicstringEduBackground="";
//编程言语
publicstringProgrameLanguage="";
}
}
frmBase类:
usingSystem;
usingSystem.Drawing;
usingSystem.Collections;
usingSystem.ComponentModel;
usingSystem.Windows.Forms;
namespaceWizard
{
///<summary>
///frmBase的择要申明。
///</summary>
publicclassfrmBase:System.Windows.Forms.Form
{
privateSystem.Windows.Forms.Panelpanel1;
privateSystem.Windows.Forms.ButtonbtnGoPrev;
privateSystem.Windows.Forms.ButtonbtnGoNext;
privateSystem.Windows.Forms.ButtonbtnOver;
privateSystem.Windows.Forms.ButtonbtnCancel;
privateSystem.Windows.Forms.ButtonbtnHelp;
///<summary>
///必须的计划器变量。
///</summary>
privateSystem.ComponentModel.Containercomponents=null;
publicfrmBase()
{
//
//Windows窗体计划器撑持所必须的
//
InitializeComponent();
//
//TODO:在InitializeComponent挪用后增加任何机关函数代码
//
}
///<summary>
///清算一切正在利用的资本。
///</summary>
protectedoverridevoidDispose(booldisposing)
{
if(disposing)
{
if(components!=null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
#regionWindows窗体计划器天生的代码
///<summary>
///计划器撑持所需的办法-不要利用代码编纂器修正
///此办法的内容。
///</summary>
privatevoidInitializeComponent()
{
this.panel1=newSystem.Windows.Forms.Panel();
this.btnGoPrev=newSystem.Windows.Forms.Button();
this.btnGoNext=newSystem.Windows.Forms.Button();
this.btnOver=newSystem.Windows.Forms.Button();
this.btnCancel=newSystem.Windows.Forms.Button();
this.btnHelp=newSystem.Windows.Forms.Button();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
//panel1
//
this.panel1.Anchor=((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom|System.Windows.Forms.AnchorStyles.Left)
|System.Windows.Forms.AnchorStyles.Right)));
this.panel1.Controls.Add(this.btnHelp);
this.panel1.Controls.Add(this.btnCancel);
this.panel1.Controls.Add(this.btnOver);
this.panel1.Controls.Add(this.btnGoNext);
this.panel1.Controls.Add(this.btnGoPrev);
this.panel1.Location=newSystem.Drawing.Point(0,202);
this.panel1.Name="panel1";
this.panel1.Size=newSystem.Drawing.Size(450,40);
this.panel1.TabIndex=0;
//
//btnGoPrev
//
this.btnGoPrev.Anchor=((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom|System.Windows.Forms.AnchorStyles.Left)));
this.btnGoPrev.Location=newSystem.Drawing.Point(25,8);
this.btnGoPrev.Name="btnGoPrev";
this.btnGoPrev.Size=newSystem.Drawing.Size(56,23);
this.btnGoPrev.TabIndex=1;
this.btnGoPrev.Text="上一步";
this.btnGoPrev.Click+=newSystem.EventHandler(this.btnGoPrev_Click);
//
//btnGoNext
//
this.btnGoNext.Anchor=((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom|System.Windows.Forms.AnchorStyles.Left)));
this.btnGoNext.Location=newSystem.Drawing.Point(105,8);
this.btnGoNext.Name="btnGoNext";
this.btnGoNext.Size=newSystem.Drawing.Size(56,23);
this.btnGoNext.TabIndex=2;
this.btnGoNext.Text="下一步";
this.btnGoNext.Click+=newSystem.EventHandler(this.btnGoNext_Click);
//
//btnOver
//
this.btnOver.Anchor=((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom|System.Windows.Forms.AnchorStyles.Left)));
this.btnOver.Location=newSystem.Drawing.Point(193,8);
this.btnOver.Name="btnOver";
this.btnOver.Size=newSystem.Drawing.Size(56,23);
this.btnOver.TabIndex=3;
this.btnOver.Text="完成";
this.btnOver.Click+=newSystem.EventHandler(this.btnOver_Click);
//
//btnCancel
//
this.btnCancel.Anchor=((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom|System.Windows.Forms.AnchorStyles.Left)));
this.btnCancel.Location=newSystem.Drawing.Point(281,8);
this.btnCancel.Name="btnCancel";
this.btnCancel.Size=newSystem.Drawing.Size(56,23);
this.btnCancel.TabIndex=4;
this.btnCancel.Text="作废";
this.btnCancel.Click+=newSystem.EventHandler(this.btnCancel_Click);
//
//btnHelp
//
this.btnHelp.Anchor=((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom|System.Windows.Forms.AnchorStyles.Left)));
this.btnHelp.Location=newSystem.Drawing.Point(369,8);
this.btnHelp.Name="btnHelp";
this.btnHelp.Size=newSystem.Drawing.Size(56,23);
this.btnHelp.TabIndex=5;
this.btnHelp.Text="匡助";
//
//frmBase
//
this.AutoScaleBaseSize=newSystem.Drawing.Size(6,14);
this.ClientSize=newSystem.Drawing.Size(450,239);
this.Controls.Add(this.panel1);
this.FormBorderStyle=System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name="frmBase";
this.StartPosition=System.Windows.Forms.FormStartPosition.CenterScreen;
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
publicWizardControllercontroller=null;
publicvoidDisableButton()
{
if(this.controller==null)
return;
if(this.controller.IsFirstForm)
{
this.btnGoPrev.Enabled=false;
}
else
{
this.btnGoPrev.Enabled=true;
}
if(this.controller.IsLastForm)
{
this.btnGoNext.Enabled=false;
}
else
{
this.btnGoNext.Enabled=true;
}
}
protectedvirtualvoidUpdateInfo()
{

}
protectedvirtualvoidGoNext()
{
UpdateInfo();
controller.GoNext();
}
protectedvirtualvoidGoPrev()
{
UpdateInfo();
controller.GoPrev();
}
protectedvirtualvoidFinish()
{
UpdateInfo();
controller.FinishWizard();
this.Visible=false;
}
protectedvirtualvoidCancel()
{
this.controller.info=null;
this.Close();
}
privatevoidbtnGoPrev_Click(objectsender,System.EventArgse)
{
GoPrev();
}
privatevoidbtnGoNext_Click(objectsender,System.EventArgse)
{
GoNext();
}
privatevoidbtnOver_Click(objectsender,System.EventArgse)
{
Finish();
}
privatevoidbtnCancel_Click(objectsender,System.EventArgse)
{
Cancel();
}
}
}
导游把持器WizardController类:
usingSystem;
usingSystem.Collections;

namespaceWizard
{
///<summary>
///WizardController的择要申明。
///</summary>
publicclassWizardController
{
publicWizardController()
{
//
//TODO:在此处增加机关函数逻辑
//
WizardForms.Add(newfrmStep1());
WizardForms.Add(newfrmStep2());
foreach(frmBasefrminWizardForms)
{
frm.controller=this;
frm.DisableButton();
}
}
privateArrayListWizardForms=newArrayList();
publicInformationinfo=newInformation();
privateintcurIndex=0;
publicboolIsFirstForm
{
get{returncurIndex==0;}
}
publicboolIsLastForm
{
get{returncurIndex==this.WizardForms.Count-1;}
}
publicvoidGoNext()
{
if(curIndex+1<WizardForms.Count)
{
((frmBase)WizardForms).Visible=false;
curIndex++;
}
else
{
return;
}
((frmBase)WizardForms).Show();
((frmBase)WizardForms).DisableButton();
}
publicvoidGoPrev()
{
if(curIndex-1>=0)
{
((frmBase)WizardForms).Visible=false;
curIndex--;
}
else
{
return;
}
((frmBase)WizardForms).Show();
((frmBase)WizardForms).DisableButton();
}
publicvoidBeginWizard()
{
((frmBase)WizardForms).Show();
((frmBase)WizardForms).DisableButton();
}
publicvoidFinishWizard()
{
curIndex=0;
Dispose();
}
privatevoidDispose()
{
foreach(frmBasefrminWizardForms)
{
frm.Close();
}
}
}
}
第一个子窗体:
usingSystem;
usingSystem.Collections;
usingSystem.ComponentModel;
usingSystem.Drawing;
usingSystem.Windows.Forms;
namespaceWizard
{
publicclassfrmStep1:Wizard.frmBase
{
privateSystem.Windows.Forms.TextBoxtxtName;
privateSystem.Windows.Forms.RadioButtonrdoMale;
privateSystem.Windows.Forms.RadioButtonradioButton1;
privateSystem.Windows.Forms.Labellabel1;
privateSystem.Windows.Forms.Labellabel2;
privateSystem.ComponentModel.IContainercomponents=null;
publicfrmStep1()
{
//该挪用是Windows窗体计划器所必须的。
InitializeComponent();
//TODO:在InitializeComponent挪用后增加任何初始化
}
///<summary>
///清算一切正在利用的资本。
///</summary>
protectedoverridevoidDispose(booldisposing)
{
if(disposing)
{
if(components!=null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
#region计划器天生的代码
///<summary>
///计划器撑持所需的办法-不要利用代码编纂器修正
///此办法的内容。
///</summary>
privatevoidInitializeComponent()
{
this.txtName=newSystem.Windows.Forms.TextBox();
this.rdoMale=newSystem.Windows.Forms.RadioButton();
this.radioButton1=newSystem.Windows.Forms.RadioButton();
this.label1=newSystem.Windows.Forms.Label();
this.label2=newSystem.Windows.Forms.Label();
this.SuspendLayout();
//
//txtName
//
this.txtName.Location=newSystem.Drawing.Point(173,61);
this.txtName.Name="txtName";
this.txtName.Size=newSystem.Drawing.Size(152,21);
this.txtName.TabIndex=1;
this.txtName.Text="";
//
//rdoMale
//
this.rdoMale.Checked=true;
this.rdoMale.Location=newSystem.Drawing.Point(205,115);
this.rdoMale.Name="rdoMale";
this.rdoMale.Size=newSystem.Drawing.Size(40,24);
this.rdoMale.TabIndex=2;
this.rdoMale.TabStop=true;
this.rdoMale.Text="男";
//
//radioButton1
//
this.radioButton1.Location=newSystem.Drawing.Point(253,115);
this.radioButton1.Name="radioButton1";
this.radioButton1.Size=newSystem.Drawing.Size(32,24);
this.radioButton1.TabIndex=3;
this.radioButton1.Text="女";
//
//label1
//
this.label1.Location=newSystem.Drawing.Point(125,64);
this.label1.Name="label1";
this.label1.Size=newSystem.Drawing.Size(48,23);
this.label1.TabIndex=4;
this.label1.Text="姓名";
//
//label2
//
this.label2.Location=newSystem.Drawing.Point(0,0);
this.label2.Name="label2";
this.label2.TabIndex=5;
//
//frmStep1
//
this.AutoScaleBaseSize=newSystem.Drawing.Size(6,14);
this.ClientSize=newSystem.Drawing.Size(450,239);
this.Controls.Add(this.label1);
this.Controls.Add(this.radioButton1);
this.Controls.Add(this.rdoMale);
this.Controls.Add(this.txtName);
this.Controls.Add(this.label2);
this.Name="frmStep1";
this.Controls.SetChildIndex(this.label2,0);
this.Controls.SetChildIndex(this.txtName,0);
this.Controls.SetChildIndex(this.rdoMale,0);
this.Controls.SetChildIndex(this.radioButton1,0);
this.Controls.SetChildIndex(this.label1,0);
this.ResumeLayout(false);
}
#endregion
protectedoverridevoidUpdateInfo()
{
this.controller.info.Name=txtName.Text.Trim();
this.controller.info.IsMale=rdoMale.Checked;
}
}
}
第二个子窗体:
usingSystem;
usingSystem.Collections;
usingSystem.ComponentModel;
usingSystem.Drawing;
usingSystem.Windows.Forms;
namespaceWizard
{
publicclassfrmStep2:Wizard.frmBase
{
privateSystem.Windows.Forms.Labellabel1;
privateSystem.Windows.Forms.Labellabel2;
privateSystem.Windows.Forms.ComboBoxcbbEduBackground;
privateSystem.Windows.Forms.CheckBoxcheckBox1;
privateSystem.Windows.Forms.CheckBoxcheckBox2;
privateSystem.Windows.Forms.CheckBoxcheckBox3;
privateSystem.Windows.Forms.CheckBoxcheckBox4;
privateSystem.ComponentModel.IContainercomponents=null;
publicfrmStep2()
{
//该挪用是Windows窗体计划器所必须的。
InitializeComponent();
//TODO:在InitializeComponent挪用后增加任何初始化
}
///<summary>
///清算一切正在利用的资本。
///</summary>
protectedoverridevoidDispose(booldisposing)
{
if(disposing)
{
if(components!=null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
#region计划器天生的代码
///<summary>
///计划器撑持所需的办法-不要利用代码编纂器修正
///此办法的内容。
///</summary>
privatevoidInitializeComponent()
{
this.label1=newSystem.Windows.Forms.Label();
this.label2=newSystem.Windows.Forms.Label();
this.cbbEduBackground=newSystem.Windows.Forms.ComboBox();
this.checkBox1=newSystem.Windows.Forms.CheckBox();
this.checkBox2=newSystem.Windows.Forms.CheckBox();
this.checkBox3=newSystem.Windows.Forms.CheckBox();
this.checkBox4=newSystem.Windows.Forms.CheckBox();
this.SuspendLayout();
//
//label1
//
this.label1.Location=newSystem.Drawing.Point(98,72);
this.label1.Name="label1";
this.label1.Size=newSystem.Drawing.Size(40,23);
this.label1.TabIndex=3;
this.label1.Text="学历";
//
//label2
//
this.label2.Location=newSystem.Drawing.Point(98,128);
this.label2.Name="label2";
this.label2.Size=newSystem.Drawing.Size(64,23);
this.label2.TabIndex=4;
this.label2.Text="编程言语";
//
//cbbEduBackground
//
this.cbbEduBackground.DropDownStyle=System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbbEduBackground.Items.AddRange(newobject[]{
"本科",
"硕士",
"博士"});
this.cbbEduBackground.Location=newSystem.Drawing.Point(170,68);
this.cbbEduBackground.Name="cbbEduBackground";
this.cbbEduBackground.Size=newSystem.Drawing.Size(152,20);
this.cbbEduBackground.TabIndex=5;
//
//checkBox1
//
this.checkBox1.Location=newSystem.Drawing.Point(166,123);
this.checkBox1.Name="checkBox1";
this.checkBox1.Size=newSystem.Drawing.Size(48,24);
this.checkBox1.TabIndex=6;
this.checkBox1.Text="C++";
//
//checkBox2
//
this.checkBox2.Location=newSystem.Drawing.Point(211,123);
this.checkBox2.Name="checkBox2";
this.checkBox2.Size=newSystem.Drawing.Size(48,24);
this.checkBox2.TabIndex=7;
this.checkBox2.Text="Java";
//
//checkBox3
//
this.checkBox3.Location=newSystem.Drawing.Point(267,123);
this.checkBox3.Name="checkBox3";
this.checkBox3.Size=newSystem.Drawing.Size(40,24);
this.checkBox3.TabIndex=8;
this.checkBox3.Text="VB";
//
//checkBox4
//
this.checkBox4.Location=newSystem.Drawing.Point(312,123);
this.checkBox4.Name="checkBox4";
this.checkBox4.Size=newSystem.Drawing.Size(40,24);
this.checkBox4.TabIndex=9;
this.checkBox4.Text="C#";
//
//frmStep2
//
this.AutoScaleBaseSize=newSystem.Drawing.Size(6,14);
this.ClientSize=newSystem.Drawing.Size(450,239);
this.Controls.Add(this.checkBox4);
this.Controls.Add(this.checkBox3);
this.Controls.Add(this.checkBox2);
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.cbbEduBackground);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name="frmStep2";
this.Controls.SetChildIndex(this.label1,0);
this.Controls.SetChildIndex(this.label2,0);
this.Controls.SetChildIndex(this.cbbEduBackground,0);
this.Controls.SetChildIndex(this.checkBox1,0);
this.Controls.SetChildIndex(this.checkBox2,0);
this.Controls.SetChildIndex(this.checkBox3,0);
this.Controls.SetChildIndex(this.checkBox4,0);
this.ResumeLayout(false);
}
#endregion
protectedoverridevoidUpdateInfo()
{
this.controller.info.EduBackground=cbbEduBackground.GetItemText(cbbEduBackground.SelectedItem);
stringlang="";
foreach(Controlctlinthis.Controls)
{
if(ctlisCheckBox&&((CheckBox)ctl).Checked)
{
lang+=ctl.Text+";";
}
}
this.controller.info.ProgrameLanguage=lang;
}
}
}
测试Demo:
usingSystem;
usingSystem.Drawing;
usingSystem.Collections;
usingSystem.ComponentModel;
usingSystem.Windows.Forms;
namespaceWizard
{
///<summary>
///frmTest的择要申明。
///</summary>
publicclassfrmTest:System.Windows.Forms.Form
{
///<summary>
///必须的计划器变量。
///</summary>
privateSystem.ComponentModel.Containercomponents=null;
privateSystem.Windows.Forms.Buttonbutton1;
privateSystem.Windows.Forms.Buttonbutton2;
privateSystem.Windows.Forms.Labellabel1;
privateSystem.Windows.Forms.Labellabel2;
privateSystem.Windows.Forms.Labellabel3;
privateSystem.Windows.Forms.Labellabel4;
privateWizardControllerwizard;
publicfrmTest()
{
//
//Windows窗体计划器撑持所必须的
//
InitializeComponent();
//
//TODO:在InitializeComponent挪用后增加任何机关函数代码
//
}
///<summary>
///清算一切正在利用的资本。
///</summary>
protectedoverridevoidDispose(booldisposing)
{
if(disposing)
{
if(components!=null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
#regionWindows窗体计划器天生的代码
///<summary>
///计划器撑持所需的办法-不要利用代码编纂器修正
///此办法的内容。
///</summary>
privatevoidInitializeComponent()
{
this.button1=newSystem.Windows.Forms.Button();
this.button2=newSystem.Windows.Forms.Button();
this.label1=newSystem.Windows.Forms.Label();
this.label2=newSystem.Windows.Forms.Label();
this.label3=newSystem.Windows.Forms.Label();
this.label4=newSystem.Windows.Forms.Label();
this.SuspendLayout();
//
//button1
//
this.button1.Location=newSystem.Drawing.Point(48,216);
this.button1.Name="button1";
this.button1.Size=newSystem.Drawing.Size(104,23);
this.button1.TabIndex=0;
this.button1.Text="显现导游";
this.button1.Click+=newSystem.EventHandler(this.button1_Click);
//
//button2
//
this.button2.Location=newSystem.Drawing.Point(192,216);
this.button2.Name="button2";
this.button2.Size=newSystem.Drawing.Size(104,23);
this.button2.TabIndex=1;
this.button2.Text="显现信息";
this.button2.Click+=newSystem.EventHandler(this.button2_Click);
//
//label1
//
this.label1.Location=newSystem.Drawing.Point(72,32);
this.label1.Name="label1";
this.label1.Size=newSystem.Drawing.Size(232,23);
this.label1.TabIndex=2;
//
//label2
//
this.label2.Location=newSystem.Drawing.Point(72,80);
this.label2.Name="label2";
this.label2.Size=newSystem.Drawing.Size(224,23);
this.label2.TabIndex=3;
//
//label3
//
this.label3.Location=newSystem.Drawing.Point(72,120);
this.label3.Name="label3";
this.label3.Size=newSystem.Drawing.Size(232,23);
this.label3.TabIndex=4;
//
//label4
//
this.label4.Location=newSystem.Drawing.Point(72,160);
this.label4.Name="label4";
this.label4.Size=newSystem.Drawing.Size(232,23);
this.label4.TabIndex=5;
//
//frmTest
//
this.AutoScaleBaseSize=newSystem.Drawing.Size(6,14);
this.ClientSize=newSystem.Drawing.Size(344,261);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name="frmTest";
this.Text="导游测试";
this.ResumeLayout(false);
}
#endregion
///<summary>
///使用程序的主出口点。
///</summary>

staticvoidMain()
{
Application.Run(newfrmTest());
}
privatevoidbutton1_Click(objectsender,System.EventArgse)
{
this.wizard=newWizardController();
this.wizard.BeginWizard();
}usingSystem;
usingSystem.Drawing;
usingSystem.Collections;
usingSystem.ComponentModel;
usingSystem.Windows.Forms;
namespaceWizard
{
///<summary>
///frmTest的择要申明。
///</summary>
publicclassfrmTest:System.Windows.Forms.Form
{
///<summary>
///必须的计划器变量。
///</summary>
privateSystem.ComponentModel.Containercomponents=null;
privateSystem.Windows.Forms.Buttonbutton1;
privateSystem.Windows.Forms.Buttonbutton2;
privateSystem.Windows.Forms.Labellabel1;
privateSystem.Windows.Forms.Labellabel2;
privateSystem.Windows.Forms.Labellabel3;
privateSystem.Windows.Forms.Labellabel4;
privateWizardControllerwizard;
publicfrmTest()
{
//
//Windows窗体计划器撑持所必须的
//
InitializeComponent();
//
//TODO:在InitializeComponent挪用后增加任何机关函数代码
//
}
///<summary>
///清算一切正在利用的资本。
///</summary>
protectedoverridevoidDispose(booldisposing)
{
if(disposing)
{
if(components!=null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
#regionWindows窗体计划器天生的代码
///<summary>
///计划器撑持所需的办法-不要利用代码编纂器修正
///此办法的内容。
///</summary>
privatevoidInitializeComponent()
{
this.button1=newSystem.Windows.Forms.Button();
this.button2=newSystem.Windows.Forms.Button();
this.label1=newSystem.Windows.Forms.Label();
this.label2=newSystem.Windows.Forms.Label();
this.label3=newSystem.Windows.Forms.Label();
this.label4=newSystem.Windows.Forms.Label();
this.SuspendLayout();
//
//button1
//
this.button1.Location=newSystem.Drawing.Point(48,216);
this.button1.Name="button1";
this.button1.Size=newSystem.Drawing.Size(104,23);
this.button1.TabIndex=0;
this.button1.Text="显现导游";
this.button1.Click+=newSystem.EventHandler(this.button1_Click);
//
//button2
//
this.button2.Location=newSystem.Drawing.Point(192,216);
this.button2.Name="button2";
this.button2.Size=newSystem.Drawing.Size(104,23);
this.button2.TabIndex=1;
this.button2.Text="显现信息";
this.button2.Click+=newSystem.EventHandler(this.button2_Click);
//
//label1
//
this.label1.Location=newSystem.Drawing.Point(72,32);
this.label1.Name="label1";
this.label1.Size=newSystem.Drawing.Size(232,23);
this.label1.TabIndex=2;
//
//label2
//
this.label2.Location=newSystem.Drawing.Point(72,80);
this.label2.Name="label2";
this.label2.Size=newSystem.Drawing.Size(224,23);
this.label2.TabIndex=3;
//
//label3
//
this.label3.Location=newSystem.Drawing.Point(72,120);
this.label3.Name="label3";
this.label3.Size=newSystem.Drawing.Size(232,23);
this.label3.TabIndex=4;
//
//label4
//
this.label4.Location=newSystem.Drawing.Point(72,160);
this.label4.Name="label4";
this.label4.Size=newSystem.Drawing.Size(232,23);
this.label4.TabIndex=5;
//
//frmTest
//
this.AutoScaleBaseSize=newSystem.Drawing.Size(6,14);
this.ClientSize=newSystem.Drawing.Size(344,261);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name="frmTest";
this.Text="导游测试";
this.ResumeLayout(false);
}
#endregion
///<summary>
///使用程序的主出口点。
///</summary>

staticvoidMain()
{
Application.Run(newfrmTest());
}
privatevoidbutton1_Click(objectsender,System.EventArgse)
{
this.wizard=newWizardController();
this.wizard.BeginWizard();
}
privatevoidbutton2_Click(objectsender,System.EventArgse)
{
if(this.wizard!=null&&this.wizard.info!=null)
{
this.label1.Text=this.wizard.info.Name;
if(this.wizard.info.IsMale)
this.label2.Text="男";
else
this.label2.Text="女";
this.label3.Text=this.wizard.info.EduBackground;
this.label4.Text=this.wizard.info.ProgrameLanguage;
}
else
{
MessageBox.Show("NULL");
}
}
}
}

privatevoidbutton2_Click(objectsender,System.EventArgse)
{
if(this.wizard!=null&&this.wizard.info!=null)
{
this.label1.Text=this.wizard.info.Name;
if(this.wizard.info.IsMale)
this.label2.Text="男";
else
this.label2.Text="女";
this.label3.Text=this.wizard.info.EduBackground;
this.label4.Text=this.wizard.info.ProgrameLanguage;
}
else
{
MessageBox.Show("NULL");
}
}
}
}

我觉得很重要,一般所说的不重要应该指的是:你学好一种以后再学另一种就很容易了。(因为这样大家可能有一个错觉就是语言不是很重要,只要随便学一种就可以了,其实不是这样的。

深爱那片海 发表于 2015-1-19 21:36:44

JSP/Servlet虽然在国内目前的应用并不广泛,但是其前途不可限量。

飘灵儿 发表于 2015-1-25 18:43:31

提供基于组件、事件驱动的可编程网络表单,大大简化了编程。还可以用ASP.NET建立网络服务。

只想知道 发表于 2015-2-3 13:15:09

逐步缩小出错代码段的范围,最终确定错误代码的位置。

乐观 发表于 2015-2-9 02:27:36

但是java靠开源打出的一片天地,特别是在微软的垄断下能打开今天的局面还是有它的生命力的。

愤怒的大鸟 发表于 2015-2-26 18:31:08

提供基于组件、事件驱动的可编程网络表单,大大简化了编程。还可以用ASP.NET建立网络服务。

第二个灵魂 发表于 2015-3-8 16:38:27

asp.net空间的支持有:ASP.NET1.1/虚拟目录/MicrosoftFrontPage2000扩展/CDONTS,同时他的网站上也提供了Asp.net的使用详解和程序源代码,相信对使用ASP.NET编程的程序员来说会非常有用哦!

小妖女 发表于 2015-3-22 20:24:55

代码逻辑混乱,难于管理:由于ASP是脚本语言混合html编程,所以你很难看清代码的逻辑关系,并且随着程序的复杂性增加,使得代码的管理十分困难,甚至超出一个程序员所能达到的管理能力,从而造成出错或这样那样的问题。
页: [1]
查看完整版本: ASP.NET编程:C#计划的一个导游程序(Wizard)框架