first commit
This commit is contained in:
115
mainProgram/NewProjectWindow.cs
Normal file
115
mainProgram/NewProjectWindow.cs
Normal file
@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
namespace mainProgram
|
||||
{
|
||||
//子窗口向父窗口传递参数:https://www.cnblogs.com/xcong/p/3386085.html
|
||||
public delegate void transferProjectManagerDelegate(ProjectManager value);
|
||||
|
||||
public partial class NewProjectWindow : Form
|
||||
{
|
||||
public NewProjectWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public event transferProjectManagerDelegate TransferEvent;//申明事件
|
||||
|
||||
private void CreateProjectBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
//获取数据
|
||||
string dataPath = DataPathTextBox.Text;
|
||||
//string currPath = Application.StartupPath;
|
||||
string projectPath = ProjectPathTextBox.Text;
|
||||
|
||||
if (dataPath != null && dataPath.Length == 0)
|
||||
{
|
||||
MessageBox.Show(this, "数据文件夹路径不能为空", "提示");
|
||||
return;
|
||||
}
|
||||
|
||||
if (projectPath != null && projectPath.Length == 0)
|
||||
{
|
||||
MessageBox.Show(this, "工程路径不能为空", "提示");
|
||||
return;
|
||||
}
|
||||
|
||||
ProjectManager projectManager = new ProjectManager(projectPath);
|
||||
|
||||
projectManager.CreateProjectStructure();
|
||||
projectManager.CopyFileToFile(dataPath);//复制原始数据文件到工程结构对应文件夹
|
||||
|
||||
|
||||
|
||||
|
||||
//ProjectManager xx = new ProjectManager();
|
||||
|
||||
////xml文件存储路径
|
||||
//string myXMLFilePath = "D:\\csharp_vs2017\\easySif\\MyComputers.xml";
|
||||
////生成xml文件
|
||||
//xx.GenerateXMLFile(myXMLFilePath);
|
||||
////遍历xml文件的信息
|
||||
//xx.GetXMLInformation(myXMLFilePath);
|
||||
////修改xml文件的信息
|
||||
//xx.ModifyXmlInformation(myXMLFilePath);
|
||||
////向xml文件添加节点信息
|
||||
//xx.AddXmlInformation(myXMLFilePath);
|
||||
////删除指定节点信息
|
||||
//xx.DeleteXmlInformation(myXMLFilePath);
|
||||
|
||||
|
||||
TransferEvent(projectManager);//触发事件
|
||||
Close();//创建工程完成后,关闭窗口
|
||||
}
|
||||
|
||||
private void SelectDataPathBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
FolderBrowserDialog dialog = new FolderBrowserDialog();
|
||||
dialog.Description = "请选择数据所在文件夹";
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (string.IsNullOrEmpty(dialog.SelectedPath))
|
||||
{
|
||||
MessageBox.Show(this, "文件夹路径不能为空", "提示");
|
||||
return;
|
||||
}
|
||||
string savePath = dialog.SelectedPath;
|
||||
|
||||
DataPathTextBox.Text = savePath;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void SelectProjectPathBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
FolderBrowserDialog dialog = new FolderBrowserDialog();
|
||||
dialog.Description = "请选择工程文件夹";
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (string.IsNullOrEmpty(dialog.SelectedPath))
|
||||
{
|
||||
MessageBox.Show(this, "文件夹路径不能为空", "提示");
|
||||
return;
|
||||
}
|
||||
string savePath = dialog.SelectedPath;
|
||||
ProjectPathTextBox.Text = savePath;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user