private void 文件夹ToolStripMenuItem1_Click(object sender, EventArgs e) { String file_name = "New folder"; String fileType = ""; file_name = nameCheck(file_name, fileType); InputBox.operationType otype = InputBox.operationType.newfile; InputBox newfile = new InputBox(current_catalog, file_name, fileType, otype); newfile.Show(); newfile.CallBack = updateView; }
private void 重命名ToolStripMenuItem_Click(object sender, EventArgs e) { ListViewItem current_item = new ListViewItem(); String fileType = ""; if (listView1.SelectedItems.Count != 0) { current_item = listView1.SelectedItems[0]; } else { MessageBox.Show("请选择一个项", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } for (int i = 0; i < current_catalog.nodelist.Count(); i += 1) { if (listViewItems[i] == current_item) { switch (current_catalog.nodelist[i].nodeType) { case Node.NodeType.folder: fileType = ""; break; case Node.NodeType.file: fileType = "txt"; break; default: break; } InputBox.operationType otype = InputBox.operationType.rename; InputBox newfile = new InputBox(current_catalog, current_catalog.nodelist[i].name, fileType, otype); newfile.Show(); newfile.CallBack = updateView; break; } } }