private void FormAttachment_FormClosed(object sender, FormClosedEventArgs e) { if (Directory.Exists(workpath) && DirectoryCore.IsEmpty(workpath)) { Directory.Delete(workpath); } }
private void 除_Click(object sender, EventArgs e) { //D:\Administrator\Desktop\MySpace\我的文件夹\回收站 //1在文件里 //2在回车站里 if (filename.IndexOf(recyclepath) != -1) { DialogResult d = MessageBox.Show("彻底删除文件夹: " + treeView1.SelectedNode.Text, "回收站", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DialogResult.Yes == d) { Directory.Delete(filename, true); treeView1.SelectedNode.Remove(); } } else { if (!DirectoryCore.IsEmpty(filename)) { DialogResult d1 = MessageBox.Show("文件夹移到回收站: " + treeView1.SelectedNode.Text, "回收站", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DialogResult.Yes == d1) { MoveToRecylebin(); } } else { MoveToRecylebin(); } } }