private void 编辑项目信息ToolStripMenuItem_Click(object sender, EventArgs e) { try { int c = listView1.SelectedIndices[0]; //获得选中项的索引 currentFolder = listView1.Items[c].SubItems[1].Text + listView1.Items[c].Text; //组装绝对地址 FmNewInfo.FormType_enum flag = FmNewInfo.FormType_enum.EDIT; if (currentPD == null) { currentPD = new ProjectDetails(); int pos_int = listView1.Items[currentRowIndex].Text.LastIndexOf("】"); currentPD.Pname = listView1.Items[currentRowIndex].Text.Remove(0, pos_int + 1); flag = FmNewInfo.FormType_enum.CREATE; } currentPD.FolderName(listView1.Items[currentRowIndex].Text); if (OpenFmNewInfo(flag) == DialogResult.OK) { ShowOnListview(); } listView1.Items[currentRowIndex].Selected = true;//设定选中 } catch { this.isActived = false; MessageBox.Show("未选择项目。", " 提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.isActived = true; } }
/// <summary> /// 设置form3的传递参数并且打开form3 /// </summary> /// <param name="formtype">form3的打开类型,NEW/EDIT</param> /// <returns>DialogResult类</returns> private DialogResult OpenFmNewInfo(FmNewInfo.FormType_enum formtype) { this.isActived = false; FmNewInfo fmNewInfo = new FmNewInfo(currentXMLpath, formtype, currentPD); DialogResult r = fmNewInfo.ShowDialog(); listView1.Focus(); this.isActived = true; return(r); }