public void DeleteVersionCommand(IExplorerRepository explorerRepository, ExplorerItemViewModel explorerItemViewModel, IExplorerTreeItem parent, string resourceName) { if (_popupController.ShowDeleteVersionMessage(resourceName) == MessageBoxResult.Yes) { explorerRepository.TryDelete(explorerItemViewModel); var parentChildren = new ObservableCollection <IExplorerItemViewModel>(parent.Children); var index = 0; for (var i = 0; i < parentChildren.Count; i++) { if (parentChildren[i].ResourceName == resourceName) { index = i; break; } } parentChildren.RemoveAt(index); parent.Children = new ObservableCollection <IExplorerItemViewModel>(parentChildren); if (parent.ChildrenCount == 0) { parent.AreVersionsVisible = true; } if (parentChildren.Count == 0) { parent.AreVersionsVisible = false; parent.IsMergeVisible = false; } _shellViewModel.UpdateExplorerWorkflowChanges(explorerItemViewModel.ResourceId); } }
public void DeleteVersionCommand(IExplorerRepository explorerRepository, ExplorerItemViewModel explorerItemViewModel, IExplorerTreeItem parent, string resourceName) { if (_popupController.ShowDeleteVersionMessage(resourceName) == MessageBoxResult.Yes) { explorerRepository.Delete(explorerItemViewModel); var parentChildren = new ObservableCollection <IExplorerItemViewModel>(parent.Children); var index = 0; for (var i = 0; i < parentChildren.Count; i++) { if (parentChildren[i].ResourceName == resourceName) { index = i; break; } } parentChildren.RemoveAt(index); parent.Children = new ObservableCollection <IExplorerItemViewModel>(parentChildren); } }