/// <summary> /// 初始化包 /// </summary> /// <param name="node"></param> private void IniPackage(TreeNode node) { var prjInfo = node.Tag as ProjectInfo; var oprate = new OprateBase <PackageInfo>(); var pckInfo = oprate.GetList(prjInfo); node.Nodes.Clear(); listView1.Items.Clear(); foreach (var item in pckInfo) { TreeNode temp = new TreeNode(item.Name); temp.Tag = item; temp.Name = item.Id; temp.ContextMenuStrip = ctxtPackage; node.Nodes.Add(temp); ListViewItem listViewItem = new ListViewItem(); listViewItem.Text = item.Name; listViewItem.Tag = item; listViewItem.ImageIndex = 0; listView1.Items.Add(listViewItem); } tslPrj.Text = $"{pckInfo.Count}个包"; tslPackage.Visible = true; tslPackage.Text = prjInfo.Name; }
private void button1_Click(object sender, EventArgs e) { if (package == null) { package = new PackageInfo(); package.Id = Guid.NewGuid().ToString(); } package.prjInfo = prjInfo; package.Name = textBox2.Text; if (checkBox1.Checked) { package.PType = PackageType.IIS; } else if (checkBox2.Checked) { package.PType = PackageType.Backage; } else if (checkBox3.Checked) { package.PType = PackageType.Sql; } var oprate = new OprateBase <PackageInfo>(); oprate.Save(package); DialogResult = DialogResult.OK; }
private void 除项目ToolStripMenuItem1_Click(object sender, EventArgs e) { ProjectInfo projectInfo = treeView.SelectedNode.Tag as ProjectInfo; var oprate = new OprateBase <ProjectInfo>(); oprate.Delete(projectInfo); IniTree(); }
private void 除包ToolStripMenuItem1_Click(object sender, EventArgs e) { PackageInfo packageInfo = treeView.SelectedNode.Tag as PackageInfo; var oprate = new OprateBase <PackageInfo>(); oprate.Delete(packageInfo); IniPackage(treeView.SelectedNode); }
private void toolStripMenuItem3_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { PackageInfo packageInfo = listView1.SelectedItems[0].Tag as PackageInfo; var oprate = new OprateBase <PackageInfo>(); oprate.Delete(packageInfo); IniPackage(FindNodeByName(packageInfo.Id, treeView.Nodes)); } }
private void button1_Click(object sender, EventArgs e) { //项目信息 ProjectInfo projectInfo = new ProjectInfo(); projectInfo.Id = textBox1.Tag?.ToString(); projectInfo.Name = textBox1.Text; projectInfo.prjSystem = textBox2.Text; projectInfo.Publisher = textBox4.Text; projectInfo.Version = textBox3.Text; projectInfo.PublishDate = dateTimePicker1.Value; var opration = new OprateBase <ProjectInfo>(); opration.Save(projectInfo); DialogResult = DialogResult.OK; }
/// <summary> /// 初始化项目树 /// </summary> private void IniTree() { var oprate = new OprateBase <ProjectInfo>(); var result = oprate.GetList(ModelSimple.Instance); treeView.Nodes.Clear(); foreach (var item in result) { TreeNode temp = new TreeNode(item.Name); temp.Tag = item; temp.Name = item.Id; temp.ContextMenuStrip = ctxtProject; treeView.Nodes.Add(temp); } tslPrj.Text = $"{result.Count}个项目"; tslPackage.Visible = false; }