//删除选中
private void btDelete_Click(object sender, EventArgs e)
{
if (MessageBox.Show("确定删除选中的文件或文件夹?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
== System.Windows.Forms.DialogResult.Yes)
{
if (lvFiles.SelectedItems.Count > 0)
{
foreach (ListViewItem item in lvFiles.SelectedItems)
{
FileStatus myfile = item.Tag as FileStatus;
if (myfile != null)
{
FSClient client = new FSClient();
bool result = client.Delete(myfile.Path, true);
string msg = string.Format("{2}:{0} 删除{1}", Path.GetFileName(myfile.Path), result ? "成功" : "失败", myfile.Isdir ? "文件夹" : "文件");
lbProgressTxt.Text = msg;
}
Application.DoEvents();
}
//重新加载
LoadFileStatus(CurrentPath);
}
}
}