/// <summary> /// 删除当前图片 /// </summary> /// <param oldName="sender"></param> /// <param oldName="e"></param> private void delIcon_Click(object sender, RoutedEventArgs e) { if (MessageBox.Show("是否删除选中图元?", "提示", MessageBoxButton.YesNo) != MessageBoxResult.Yes) { return; } BindingList <Node> nodeList = this.piclistView.ItemsSource as BindingList <Node>; List <Node> tmp = new List <Node>(); foreach (Node item in this.piclistView.SelectedItems) { tmp.Add(item); } foreach (Node item in tmp) { ///删除对应的文件 String timeFile = _picManager.getFilePathFromName(item.Name); String file = Path.Combine(SVProData.IconPath, timeFile); File.Delete(file); ///删除列表 nodeList.Remove(item); ///删除管理数据 _picManager.removeItem(this.classlistView.SelectedValue as String, item.Name); } ///保存文件数据 saveIconInfo(); }
/* * 删除指定图标项 * */ void delItem_Click(object sender, EventArgs e) { foreach (ListViewItem item in listView.SelectedItems) { ///删除对应的文件 String timeFile = _pixmapManage.getFilePathFromName(item.Text); String file = Path.Combine(SVProData.IconPath, timeFile); File.Delete(file); ///删除列表 listView.Items.Remove(item); ///删除管理数据 _pixmapManage.removeItem(treeView.SelectedNode.Text, item.Text); ///保存文件数据 saveIconInfo(); } }