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

📄 newfilewizard.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;

using System.IO;

namespace Magic_IDE
{
	/// <summary>
	/// Summary description for NewFileWizard.
	/// </summary>
	public class NewFileWizard : System.Windows.Forms.Form
	{
		private Crownwood.Magic.Controls.WizardControl m_Wizard;
		private Crownwood.Magic.Controls.WizardPage m_Page1;
		private System.Windows.Forms.TextBox m_txtFileName;
		private System.Windows.Forms.Label label1;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		private Project m_Project = null;
		public NewFileWizard(Project project)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
			m_Project = project;
		}

		/// <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_txtFileName = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.m_Page1.SuspendLayout();
			this.SuspendLayout();
			// 
			// m_Wizard
			// 
			this.m_Wizard.Name = "m_Wizard";
			this.m_Wizard.SelectedIndex = 0;
			this.m_Wizard.ShowBackButton = Crownwood.Magic.Controls.WizardControl.Status.No;
			this.m_Wizard.ShowNextButton = Crownwood.Magic.Controls.WizardControl.Status.No;
			this.m_Wizard.Size = new System.Drawing.Size(476, 352);
			this.m_Wizard.TabIndex = 0;
			this.m_Wizard.Title = "Create New File Wizard";
			this.m_Wizard.WizardPages.AddRange(new Crownwood.Magic.Controls.WizardPage[] {
																							 this.m_Page1});
			this.m_Wizard.CancelClick += new System.EventHandler(this.m_Wizard_CancelClick);
			this.m_Wizard.FinishClick += new System.EventHandler(this.m_Wizard_FinishClick);
			// 
			// m_Page1
			// 
			this.m_Page1.CaptionTitle = "(Page Title)";
			this.m_Page1.Controls.AddRange(new System.Windows.Forms.Control[] {
																				  this.m_txtFileName,
																				  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 = "(Page Description not defined)";
			this.m_Page1.TabIndex = 3;
			// 
			// m_txtFileName
			// 
			this.m_txtFileName.Location = new System.Drawing.Point(112, 40);
			this.m_txtFileName.Name = "m_txtFileName";
			this.m_txtFileName.Size = new System.Drawing.Size(328, 21);
			this.m_txtFileName.TabIndex = 3;
			this.m_txtFileName.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 = 2;
			this.label1.Text = "Project Name:";
			// 
			// NewFileWizard
			// 
			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 = "NewFileWizard";
			this.Text = "NewFileWizard";
			this.m_Page1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

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

		public ProjectFile ProjectFile;

		private void m_Wizard_FinishClick(object sender, System.EventArgs e)
		{
			string fileName = m_txtFileName.Text;

			if(!Path.HasExtension(fileName))
				fileName += ".sh";
			
			if(File.Exists(m_Project.Directory + "\\" + fileName))
			{
				MessageBox.Show("File already exists.");
				return;
			}

			ProjectFile = ProjectFile.Create(m_Project,m_Project.Directory + "\\" + fileName);
			DialogResult = DialogResult.OK;
			Close();
		}
	}
}

⌨️ 快捷键说明

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