private void button_newFile_Click(object sender, System.EventArgs e) { FileNameDlg dlg = new FileNameDlg(); GuiUtil.AutoSetDefaultFont(dlg); dlg.StartPosition = FormStartPosition.CenterScreen; dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) { return; } // 看看文件名是否重复创建 if (GetFileNameItemIndex(dlg.textBox_fileName.Text) != -1) { MessageBox.Show(this, "文件" + dlg.textBox_fileName.Text + "已经存在,不能重复创建..."); return; } string strFileName = textBox_projectLocate.Text + "\\" + dlg.textBox_fileName.Text; if (String.Compare(dlg.textBox_fileName.Text, "main.cs", true) == 0) { // ScriptManager.CreateDefaultMainCsFile(strFileName); scriptManager.OnCreateDefaultContent(strFileName); } else if (String.Compare(dlg.textBox_fileName.Text, "marcfilter.fltx", true) == 0) { // ScriptManager.CreateDefaultMarcFilterFile(strFileName); scriptManager.OnCreateDefaultContent(strFileName); } else if (String.Compare(dlg.textBox_fileName.Text, "references.xml", true) == 0) { // TODO: 应修改为事件驱动 ScriptManager.CreateDefaultReferenceXmlFile(strFileName); } else if (String.Compare(dlg.textBox_fileName.Text, "metadata.xml", true) == 0) { Debug.Assert(string.IsNullOrEmpty(this.HostName) == false, ""); // TODO: 应修改为事件驱动 ScriptManager.CreateDefaultMetadataXmlFile(strFileName, this.HostName); } else { using (StreamWriter sw = new StreamWriter(strFileName)) { sw.WriteLine(""); } } // 装入listview LoadFileInfo(); int nIndex = GetFileNameItemIndex(dlg.textBox_fileName.Text); if (nIndex != -1) { listView_files.SelectedItems.Clear(); listView_files.Items[nIndex].Selected = true; } }
private void button_newFile_Click(object sender, System.EventArgs e) { FileNameDlg dlg = new FileNameDlg(); GuiUtil.AutoSetDefaultFont(dlg); dlg.StartPosition = FormStartPosition.CenterScreen; dlg.ShowDialog(this); if (dlg.DialogResult != DialogResult.OK) return; // 看看文件名是否重复创建 if (GetFileNameItemIndex(dlg.textBox_fileName.Text) != -1) { MessageBox.Show(this, "文件" + dlg.textBox_fileName.Text + "已经存在,不能重复创建..."); return; } string strFileName = textBox_projectLocate.Text + "\\" + dlg.textBox_fileName.Text; if (String.Compare(dlg.textBox_fileName.Text, "main.cs", true) == 0) { // ScriptManager.CreateDefaultMainCsFile(strFileName); scriptManager.OnCreateDefaultContent(strFileName); } else if (String.Compare(dlg.textBox_fileName.Text, "marcfilter.fltx", true) == 0) { // ScriptManager.CreateDefaultMarcFilterFile(strFileName); scriptManager.OnCreateDefaultContent(strFileName); } else if (String.Compare(dlg.textBox_fileName.Text, "references.xml", true) == 0) { // TODO: 应修改为事件驱动 ScriptManager.CreateDefaultReferenceXmlFile(strFileName); } else if (String.Compare(dlg.textBox_fileName.Text, "metadata.xml", true) == 0) { Debug.Assert(string.IsNullOrEmpty(this.HostName) == false, ""); // TODO: 应修改为事件驱动 ScriptManager.CreateDefaultMetadataXmlFile(strFileName, this.HostName); } else { using (StreamWriter sw = new StreamWriter(strFileName)) { sw.WriteLine(""); } } // 装入listview LoadFileInfo(); int nIndex = GetFileNameItemIndex(dlg.textBox_fileName.Text); if (nIndex != -1) { listView_files.SelectedItems.Clear(); listView_files.Items[nIndex].Selected = true; } }