private async Task RemoveFolderImpl() { if (CurrentFolder == null) { return; } try { var result = await FileOperationView.Delete(_window, _overlay, _filesystem, CurrentFolder); if (!result) { return; } var tv = SelectedFolderNode.TreeView; var node = tv.Nodes.Find(CurrentFolder.FullName, true).FirstOrDefault(); node?.Parent.Nodes.Remove(node); } catch (Exception ex) { TaskDialog.Show(_window, $"Failed to remove folder {CurrentFolder.FullName}", ex); } _overlay.Hide(); }
private async Task RemoveItemsImpl() { var items = SelectedItems.Where(item => item.Tag != null).Select(item => item.Tag).ToArray(); if (items.Length == 0) { return; } try { var result = await FileOperationView.Delete(_window, _overlay, _filesystem, items); if (!result) { return; } foreach (var folder in items.OfType <IFolder>()) { var node = SelectedFolderNode.Nodes .Cast <TreeNode>() .FirstOrDefault(x => x.Text.Equals(folder.Name, StringComparison.OrdinalIgnoreCase)); if (node != null) { SelectedFolderNode.Nodes.Remove(node); } } UpdateListViewItems(); } catch (Exception ex) { TaskDialog.Show(_window, "Failed to delete some items", ex); } _overlay.Hide(); }