⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newprojectwizard.cs

📁 compiler programming, code something
💻 CS
字号:
/*
Magic IDE
Copyright (C) 2003  Michael Bebenita

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Magic_IDE
{
	/// <summary>
	/// Summary description for NewProjectWizard.
	/// </summary>
	public class NewProjectWizard : System.Windows.Forms.Form
	{
		private Crownwood.Magic.Controls.WizardControl m_Wizard;
		private Crownwood.Magic.Controls.WizardPage m_Page1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox m_txtProjectName;
		private Crownwood.Magic.Controls.WizardPage m_Page2;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.TextBox m_txtLocation;
		private System.Windows.Forms.CheckBox m_chkCreateDirectory;
		private System.Windows.Forms.Button m_btnBrowse;
		private System.Windows.Forms.Label m_lblPath;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public NewProjectWizard()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//

			m_txtLocation.Text = Environment.CurrentDirectory;
			UpdateLocation(null,null);
		}

		/// <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 Windows Form 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.m_Wizard = new Crownwood.Magic.Controls.WizardControl();
			this.m_Page1 = new Crownwood.Magic.Controls.WizardPage();
			this.m_txtProjectName = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.m_Page2 = new Crownwood.Magic.Controls.WizardPage();
			this.m_lblPath = new System.Windows.Forms.Label();
			this.m_btnBrowse = new System.Windows.Forms.Button();
			this.m_chkCreateDirectory = new System.Windows.Forms.CheckBox();
			this.m_txtLocation = new System.Windows.Forms.TextBox();
			this.label2 = new System.Windows.Forms.Label();
			this.m_Page1.SuspendLayout();
			this.m_Page2.SuspendLayout();
			this.SuspendLayout();
			// 
			// m_Wizard
			// 
			this.m_Wizard.Name = "m_Wizard";
			this.m_Wizard.SelectedIndex = 0;
			this.m_Wizard.Size = new System.Drawing.Size(476, 352);
			this.m_Wizard.TabIndex = 0;
			this.m_Wizard.Title = "Create New Project Wizard";
			this.m_Wizard.WizardPages.AddRange(new Crownwood.Magic.Controls.WizardPage[] {
																							 this.m_Page1,
																							 this.m_Page2});
			this.m_Wizard.CancelClick += new System.EventHandler(this.m_Wizard_CancelClick);
			this.m_Wizard.NextClick += new System.ComponentModel.CancelEventHandler(this.m_Wizard_NextClick);
			this.m_Wizard.FinishClick += new System.EventHandler(this.m_Wizard_FinishClick);
			// 
			// m_Page1
			// 
			this.m_Page1.CaptionTitle = "Project Name";
			this.m_Page1.Controls.AddRange(new System.Windows.Forms.Control[] {
																				  this.m_txtProjectName,
																				  this.label1});
			this.m_Page1.FullPage = false;
			this.m_Page1.Name = "m_Page1";
			this.m_Page1.Size = new System.Drawing.Size(476, 223);
			this.m_Page1.SubTitle = "";
			this.m_Page1.TabIndex = 3;
			// 
			// m_txtProjectName
			// 
			this.m_txtProjectName.Location = new System.Drawing.Point(112, 40);
			this.m_txtProjectName.Name = "m_txtProjectName";
			this.m_txtProjectName.Size = new System.Drawing.Size(328, 21);
			this.m_txtProjectName.TabIndex = 1;
			this.m_txtProjectName.Text = "";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(16, 44);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(84, 16);
			this.label1.TabIndex = 0;
			this.label1.Text = "Project Name:";
			// 
			// m_Page2
			// 
			this.m_Page2.CaptionTitle = "";
			this.m_Page2.Controls.AddRange(new System.Windows.Forms.Control[] {
																				  this.m_lblPath,
																				  this.m_btnBrowse,
																				  this.m_chkCreateDirectory,
																				  this.m_txtLocation,
																				  this.label2});
			this.m_Page2.FullPage = false;
			this.m_Page2.Name = "m_Page2";
			this.m_Page2.Selected = false;
			this.m_Page2.Size = new System.Drawing.Size(476, 223);
			this.m_Page2.SubTitle = "";
			this.m_Page2.TabIndex = 4;
			this.m_Page2.Title = "";
			// 
			// m_lblPath
			// 
			this.m_lblPath.Location = new System.Drawing.Point(112, 104);
			this.m_lblPath.Name = "m_lblPath";
			this.m_lblPath.Size = new System.Drawing.Size(328, 16);
			this.m_lblPath.TabIndex = 4;
			// 
			// m_btnBrowse
			// 
			this.m_btnBrowse.Location = new System.Drawing.Point(412, 40);
			this.m_btnBrowse.Name = "m_btnBrowse";
			this.m_btnBrowse.Size = new System.Drawing.Size(28, 20);
			this.m_btnBrowse.TabIndex = 3;
			this.m_btnBrowse.Text = "...";
			this.m_btnBrowse.Click += new System.EventHandler(this.m_btnBrowse_Click);
			// 
			// m_chkCreateDirectory
			// 
			this.m_chkCreateDirectory.Checked = true;
			this.m_chkCreateDirectory.CheckState = System.Windows.Forms.CheckState.Checked;
			this.m_chkCreateDirectory.Location = new System.Drawing.Point(112, 72);
			this.m_chkCreateDirectory.Name = "m_chkCreateDirectory";
			this.m_chkCreateDirectory.Size = new System.Drawing.Size(152, 16);
			this.m_chkCreateDirectory.TabIndex = 2;
			this.m_chkCreateDirectory.Text = "Create Project Directory";
			this.m_chkCreateDirectory.CheckedChanged += new System.EventHandler(this.UpdateLocation);
			// 
			// m_txtLocation
			// 
			this.m_txtLocation.Location = new System.Drawing.Point(112, 40);
			this.m_txtLocation.Name = "m_txtLocation";
			this.m_txtLocation.Size = new System.Drawing.Size(292, 21);
			this.m_txtLocation.TabIndex = 1;
			this.m_txtLocation.Text = "";
			this.m_txtLocation.TextChanged += new System.EventHandler(this.UpdateLocation);
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(16, 44);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(68, 16);
			this.label2.TabIndex = 0;
			this.label2.Text = "Location: ";
			// 
			// NewProjectWizard
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(476, 350);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.m_Wizard});
			this.Name = "NewProjectWizard";
			this.Text = "New Project Wizard";
			this.m_Page1.ResumeLayout(false);
			this.m_Page2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void m_Wizard_NextClick(object sender, System.ComponentModel.CancelEventArgs e)
		{
			UpdateLocation(null,null);
		}

		private void UpdateLocation(object sender, System.EventArgs e)
		{
			m_lblPath.Text = m_txtLocation.Text;
			if(m_chkCreateDirectory.Checked)
				m_lblPath.Text += "\\" + m_txtProjectName.Text;
		}

		private void m_btnBrowse_Click(object sender, System.EventArgs e)
		{
			MessageBox.Show("Not yet implemented.");
		}

		public string ProjectName
		{
			get{return m_txtProjectName.Text;}
		}

		public string ProjectPath
		{
			get{return m_lblPath.Text;}
		}

		private void m_Wizard_FinishClick(object sender, System.EventArgs e)
		{

			if(!System.IO.Directory.Exists(m_txtLocation.Text))
			{
				MessageBox.Show("Specified location doesn't exist.");
				return;
			}

			if(m_chkCreateDirectory.Checked)
			{
				if(!System.IO.Directory.Exists(m_lblPath.Text))
				{
					System.IO.Directory.CreateDirectory(m_lblPath.Text);
				}
			}

			DialogResult = DialogResult.OK;

			
			Close();
		}

		private void m_Wizard_CancelClick(object sender, System.EventArgs e)
		{
			DialogResult = DialogResult.Cancel;
			Close();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -