📄 newprojectdialog.cs
字号:
// TODO : CREATE TEXT FILE:
}
project.SaveProject(ProjectLocation + "\\" + nametextbox.Text + ".prjX");
window.ProjectBrowser.OpenProject(ProjectLocation + "\\" + nametextbox.Text + ".prjX");
window.ProjectMode = true;
foreach (FileDescriptionTemplate file in item.Template.OpenFiles) {
string longfilename = ProjectSolution + "\\" + StringParser.Parse(file.Name, new string[,] { {"PROJECT", nametextbox.Text}});
window.OpenWindow(longfilename);
}
DialogResult = DialogResult.OK;
} else {
MessageBox.Show(Resource.GetString("Dialog.NewProject.EmptyProjectFieldWarning"), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
void BrowseDirectories(object sender, EventArgs e) // TODO : Directory Browser
{
OpenFileDialog fdiag = new OpenFileDialog();
fdiag.AddExtension = false;
fdiag.Multiselect = false;
fdiag.CheckFileExists = false;
fdiag.CheckPathExists = true;
fdiag.RestoreDirectory = true;
if (fdiag.ShowDialog() == DialogResult.OK) {
locationcombobox.Text = fdiag.FileName;
}
fdiag.Dispose();
}
// list view event handlers
void SelectedIndexChange(object sender, EventArgs e)
{
if (templateview.SelectedItems.Count == 1) {
descriptionlabel.Text = ((TemplateItem)templateview.SelectedItems[0]).Template.Description;
okbutton.Enabled = true;
} else {
descriptionlabel.Text = "";
okbutton.Enabled = false;
}
}
private void InitializeComponent()
{
tooltip = new ToolTip(components);
tooltip.SetToolTip(largeiconbutton, Resource.GetString("Global.LargeIconToolTip"));
tooltip.SetToolTip(smalliconbutton, Resource.GetString("Global.SmallIconToolTip"));
tooltip.Active = true;
solutionnametextbox.Location = new Point(112, 320);
solutionnametextbox.TabIndex = 16;
solutionnametextbox.Size = new Size(192, 20);
solutionnametextbox.ReadOnly = true;
solutionnametextbox.TextChanged += new EventHandler(PathChanged);
nametextbox.Location = new Point(112, 272);
nametextbox.TabIndex = 7;
nametextbox.Size = new Size(392, 20);
nametextbox.TextChanged += new EventHandler(NameTextChanged);
nametextbox.TextChanged += new EventHandler(PathChanged);
locationcombobox.Location = new Point(112, 296);
locationcombobox.Size = new Size(312, 21);
locationcombobox.TabIndex = 8;
locationcombobox.TextChanged += new EventHandler(PathChanged);
label1.Location = new Point(8, 12);
label1.Text = Resource.GetString("Dialog.NewProject.ProjectTypeLabelText");
label1.Size = new Size(136, 12);
label1.TabIndex = 4;
label2.Location = new Point(224, 12);
label2.Text = Resource.GetString("Dialog.NewProject.TemplateLabelText");
label2.Size = new Size(168, 12);
label2.TabIndex = 5;
label4.Location = new Point(8, 272);
label4.Text = Resource.GetString("Dialog.NewProject.NameLabelText");
label4.Size = new Size(104, 24);
label4.TabIndex = 13;
label5.Location = new Point(8, 296);
label5.Text = Resource.GetString("Dialog.NewProject.LocationLabelText");
label5.Size = new Size(100, 24);
label5.TabIndex = 14;
label6.Location = new Point(8, 320);
label6.Text = Resource.GetString("Dialog.NewProject.NewSolutionLabelText");
label6.Size = new Size(104, 24);
label6.TabIndex = 15;
label7.Location = new Point(8, 368);
label7.Size = new Size(496, 2);
label7.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
label7.TabIndex = 18;
const int MODIFICATOR = 10;
createdinlabel.Location = new Point(8, 352 - MODIFICATOR);
createdinlabel.Size = new Size(496, 16 + MODIFICATOR);
createdinlabel.TabIndex = 19;
descriptionlabel.Location = new Point(8, 248);
descriptionlabel.Size = new Size(496, 16);
descriptionlabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
descriptionlabel.TabIndex = 6;
smalliconbutton.Location = new Point(480, 2);
smalliconbutton.Size = new Size(24, 24);
smalliconbutton.Appearance = System.Windows.Forms.Appearance.Button;
smalliconbutton.TabIndex = 3;
smalliconbutton.CheckedChanged += new EventHandler(IconSizeChange);
largeiconbutton.Location = new Point(455, 2);
largeiconbutton.Size = new Size(24, 24);
largeiconbutton.Appearance = System.Windows.Forms.Appearance.Button;
largeiconbutton.TabIndex = 2;
largeiconbutton.Checked = true;
largeiconbutton.CheckedChanged += new EventHandler(IconSizeChange);
okbutton.Location = new Point(264, 376);
okbutton.DialogResult = System.Windows.Forms.DialogResult.OK;
okbutton.Size = new Size(72, 24);
okbutton.TabIndex = 9;
okbutton.Text = Resource.GetString("Global.OKButtonText");
okbutton.Click += new EventHandler(OpenEvent);
cancelbutton.Location = new Point(344, 376);
cancelbutton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
cancelbutton.Size = new Size(72, 24);
cancelbutton.TabIndex = 10;
cancelbutton.Text = Resource.GetString("Global.CancelButtonText");
helpbutton.Location = new Point(424, 376);
helpbutton.Size = new Size(72, 24);
helpbutton.TabIndex = 11;
helpbutton.Text = Resource.GetString("Global.HelpButtonText");
browsebutton.Location = new Point(432, 296);
browsebutton.Size = new Size(72, 24);
browsebutton.TabIndex = 12;
browsebutton.Text = Resource.GetString("Global.BrowseButtonText");
browsebutton.Click += new EventHandler(BrowseDirectories);
checkBox1.Location = new Point(312, 320);
checkBox1.Text = Resource.GetString("Dialog.NewProject.checkBox1Text");
checkBox1.Size = new Size(200, 24);
checkBox1.TabIndex = 17;
checkBox1.CheckedChanged += new EventHandler(CheckedChange);
checkBox1.CheckedChanged += new EventHandler(PathChanged);
templateview.Location = new Point(224, 28);
templateview.Size = new Size(280, 220);
templateview.HideSelection = false;
templateview.MultiSelect = false;
templateview.ForeColor = System.Drawing.SystemColors.WindowText;
templateview.TabIndex = 1;
templateview.DoubleClick += new EventHandler(OpenEvent);
templateview.SelectedIndexChanged += new EventHandler(SelectedIndexChange);
projecttypetree.Location = new Point(8, 28);
projecttypetree.Size = new Size(215, 220);
projecttypetree.HideSelection = false;
projecttypetree.TabIndex = 0;
projecttypetree.Sorted = true;
projecttypetree.AfterSelect += new TreeViewEventHandler(CategoryChange);
projecttypetree.BeforeSelect += new TreeViewCancelEventHandler(OnBeforeExpand);
projecttypetree.BeforeExpand += new TreeViewCancelEventHandler(OnBeforeExpand);
projecttypetree.BeforeCollapse += new TreeViewCancelEventHandler(OnBeforeCollapse);
ImageList imglist = new ImageList();
imglist.Images.Add(Resource.GetBitmap("Icons.16x16.OpenFolderBitmap"));
imglist.Images.Add(Resource.GetBitmap("Icons.16x16.ClosedFolderBitmap"));
projecttypetree.ImageList = imglist;
this.Text = Resource.GetString("Dialog.NewProject.DialogName");
this.MaximizeBox = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.AutoScaleBaseSize = new Size(5, 13);
this.CancelButton = cancelbutton;
this.FormBorderStyle = FormBorderStyle.FixedDialog;
this.ShowInTaskbar = false;
this.AcceptButton = okbutton;
// this.TopMost = true;
this.MinimizeBox = false;
this.ClientSize = new Size(514, 407);
this.Controls.Add(createdinlabel);
this.Controls.Add(label7);
this.Controls.Add(checkBox1);
this.Controls.Add(solutionnametextbox);
this.Controls.Add(label6);
this.Controls.Add(label5);
this.Controls.Add(label4);
this.Controls.Add(browsebutton);
this.Controls.Add(helpbutton);
this.Controls.Add(cancelbutton);
this.Controls.Add(okbutton);
this.Controls.Add(locationcombobox);
this.Controls.Add(nametextbox);
this.Controls.Add(descriptionlabel);
this.Controls.Add(label2);
this.Controls.Add(label1);
this.Controls.Add(smalliconbutton);
this.Controls.Add(largeiconbutton);
this.Controls.Add(templateview);
this.Controls.Add(projecttypetree);
}
public override void Dispose()
{
base.Dispose();
components.Dispose();
}
/// <summary>
/// Represents a category
/// </summary>
internal class Category : TreeNode
{
ArrayList categories = new ArrayList();
ArrayList templates = new ArrayList();
string name;
public Category(string name) : base(name)
{
this.name = name;
ImageIndex = 1;
}
public string Name {
get {
return name;
}
}
public ArrayList Categories {
get {
return categories;
}
}
public ArrayList Templates {
get {
return templates;
}
}
}
/// <summary>
/// Holds a new file template
/// </summary>
internal class TemplateItem : ListViewItem
{
ProjectTemplate template;
public TemplateItem(ProjectTemplate template) : base(template.Name)
{
this.template = template;
ImageIndex = 0;
}
public ProjectTemplate Template {
get {
return template;
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -