private void btnFinish_Click(object sender, EventArgs e) { btnFinish.Enabled = false; btnFinish.Text = "执行中……"; if (solutionControl.Valid()) { try { SolutionCreator creator = new SolutionCreator(); if (Home.form_Database.GetTreeView1Selected().Count <= 0) { MessageBox.Show("没有找到你选择的Table,请双击展开Selected Table", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); btnFinish.Enabled = true; btnFinish.Text = "&Finish"; return; } string db = ((Model.TreeNodeTag)Home.form_Database.GetTreeView1Selected()[0].Parent.Tag).Tag.ToString(); var tvTables = Home.form_Database.InitTreeView(db); string dtime = DateTime.Now.ToString("yyMMddHHmmss"); string date = dtime;// DateTime.Now.ToString("yyMMddHH24mmsszzz").Substring(0, DateTime.Now.ToString("yyMMddHH24mmsszzz").Length - 8); string path = solutionControl.Path + "\\" + date; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } creator.CreateSolution(db + "_" + configControl.SolutionName, path, tvTables, configControl.dataAccessType, configControl.architectureType, solutionControl.gridSolution, Config.GetConnectionString(StaticTool.ServerID)); //creator.CreateSolution(configControl.SolutionName,@"C:\Users\JiangYanJun\Desktop\新建文件夹", tableControl.tvTables, // configControl.dataAccessType, configControl.architectureType, solutionControl.gridSolution, connectionControl.ConnectionString); MessageBox.Show("项目成功生成目录在:" + Environment.NewLine + Environment.NewLine + path, "\t\t成功生成", MessageBoxButtons.OK, MessageBoxIcon.None); } catch (Exception ex) { MessageBox.Show("该项目创建过程中发生了错误。 详情: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DeleteUselessFiles(); } } else { MessageBox.Show("Please fill all required fields.", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning); } btnFinish.Enabled = true; btnFinish.Text = "&Finish"; }