private void OnDeleteFileCommand() { DeleteFileWindow deleteFileWindow = new DeleteFileWindow(SelectProjectFilesEntity); deleteFileWindow.Closed += deleteFileWindow_Closed; deleteFileWindow.Show(); }
/* * 点击 - 批量删除图片 */ private void Batch_Delete_Click(object sender, RoutedEventArgs e) { List <StorageFile> list = new List <StorageFile>();//创建了一个空列表 List <Canvas> canvasList = new List <Canvas>(); UIElementCollection children = storageListWrap.Children; //1.获取所有勾选图片,同时移除选中 for (int i = 0; i < children.Count; i++) { Canvas canvas = (Canvas)children[i]; FileListTag tag = (FileListTag)canvas.Tag; if (tag.isSelected) { list.Add(tag.storageFile); canvasList.Add(canvas); } } DeleteFileWindow win = new DeleteFileWindow(storageListWrap, list, canvasList); win.ShowDialog(); ////3.删除数据库记录 //foreach (StorageFile storageFile in list) //{ // int row = storageFileBll.delete(storageFile); //} ////4.从页面移除选中项 //foreach (Canvas canvas in canvasList) //{ // storageListWrap.Children.Remove(canvas); //} }