public void CreatList() { PLTool tool = new PLTool(); ArrayList allTools = null; try { allTools = tool.GetAllTools(); } catch (EnvironmentException exception) { MessageBox.Show(exception.Message, "工具软件管理", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } catch { MessageBox.Show("显示工具软件信息失败!", "工具软件管理", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } for (int i = 0; i < allTools.Count; i++) { DETool tool2 = (DETool)allTools[i]; string[] items = new string[] { tool2.Name, tool2.Creator, tool2.CreateTime.ToString("yyyy-MM-dd"), tool2.Description }; ListViewItem item = new ListViewItem(items) { Tag = tool2, ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_ENV_TOOL") }; this.lvwTool.Items.Add(item); } }
public void CreateList() { this.lvwFile.Items.Clear(); PLFileType type = new PLFileType(); ArrayList allFileTypes = null; try { allFileTypes = type.GetAllFileTypes(); } catch (EnvironmentException exception) { MessageBox.Show(exception.Message, "文件类型管理", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } catch { MessageBox.Show("显示文件类型信息失败!", "文件类型管理", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } for (int i = 0; i < allFileTypes.Count; i++) { DEFileType type2 = (DEFileType)allFileTypes[i]; string str = ""; if ((type2.Option & 1) == 1) { str = "是"; } else { str = "否"; } string name = ""; for (int j = 0; j < this.allTools.Count; j++) { DETool tool = (DETool)this.allTools[j]; if (tool.Oid.Equals(type2.ToolOid)) { name = tool.Name; } } string str3 = ""; for (int k = 0; k < this.allEditor.Count; k++) { DEBrowser browser = (DEBrowser)this.allEditor[k]; if (browser.Oid.Equals(type2.DefaultEditorOid)) { str3 = browser.Name; } } string[] items = new string[] { type2.Name, type2.Postfix, name, type2.DefaultBrowserName, str3, str, type2.Creator, type2.CreatTime.ToString("yyyy-MM-dd HH:mm:ss"), type2.Description }; ListViewItem item = new ListViewItem(items) { Tag = type2, ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_ENV_FILETYPE") }; this.lvwFile.Items.Add(item); } }
private void cmiEdit_Click(object sender, EventArgs e) { if (this.lvwTool.SelectedItems[0].Tag != null) { DETool tag = (DETool)this.lvwTool.SelectedItems[0].Tag; FrmSetTool tool2 = new FrmSetTool(tag, true); if (tool2.ShowDialog() == DialogResult.OK) { DETool deTool = new DETool(); deTool = tool2.deTool; this.lvwTool.SelectedItems[0].SubItems[0].Text = deTool.Name; this.lvwTool.SelectedItems[0].SubItems[1].Text = deTool.Creator; this.lvwTool.SelectedItems[0].SubItems[2].Text = deTool.CreateTime.ToString("yyyy-MM-dd"); this.lvwTool.SelectedItems[0].SubItems[3].Text = deTool.Description; this.lvwTool.SelectedItems[0].Tag = deTool; } tool2.Dispose(); } }
private void cmiDel_Click(object sender, EventArgs e) { if (this.lvwTool.SelectedItems[0].Tag != null) { DETool tag = (DETool)this.lvwTool.SelectedItems[0].Tag; if (MessageBox.Show("是否删除选中工具软件?", "删除工具软件", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { PLTool tool2 = new PLTool(); try { tool2.Delete(ClientData.LogonUser.LogId, tag.Oid); this.lvwTool.SelectedItems[0].Remove(); } catch (EnvironmentException exception) { MessageBox.Show(exception.Message, "删除工具软件", MessageBoxButtons.OK, MessageBoxIcon.Hand); } catch { MessageBox.Show("删除工具软件失败!", "删除工具软件", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } } }
public void NewFileType(object sender, EventArgs e) { FrmFTDialog dialog = new FrmFTDialog(); if (dialog.ShowDialog() == DialogResult.OK) { DEFileType deF = dialog.deF; this.GetBaseToolAndEdit(); string[] items = new string[9]; items[0] = deF.Name; items[1] = deF.Postfix; bool flag = false; for (int i = 0; i < this.allTools.Count; i++) { DETool tool = (DETool)this.allTools[i]; if (tool.Oid.Equals(deF.ToolOid)) { items[2] = tool.Name; flag = true; } } if (!flag) { items[2] = ""; } flag = false; items[3] = deF.DefaultBrowserName; for (int j = 0; j < this.allEditor.Count; j++) { DEBrowser browser = (DEBrowser)this.allEditor[j]; if (browser.Oid.Equals(deF.DefaultEditorOid)) { items[4] = browser.Name; flag = true; } } if (!flag) { items[4] = ""; } if ((deF.Option & 1) == 1) { items[5] = "是"; } else { items[5] = "否"; } items[6] = deF.Creator; items[7] = deF.CreatTime.ToString("yyyy-MM-dd HH:mm:ss"); items[8] = deF.Description; ListViewItem item = new ListViewItem(items) { Tag = deF, ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_ENV_FILETYPE") }; this.lvwFile.Items.Add(item); int count = this.lvwFile.Items.Count; this.lvwFile.Items[count - 1].Selected = true; } dialog.Dispose(); }