private static void _removeAllSelected(LayerageCollection layerageCollection, IList <Layerage> layerages) { foreach (Layerage layerage in layerages) { ILayer layer = layerage.Self; //Recursive if (layer.IsSelected == true) { //Refactoring layer.IsRefactoringTransformer = true; layer.IsRefactoringRender = true; layer.IsRefactoringIconRender = true; layerage.RefactoringParentsTransformer(); layerage.RefactoringParentsRender(); layerage.RefactoringParentsIconRender(); LayerageCollection._removeAll(layerageCollection, layerage.Children); } //Recursive else { LayerageCollection._removeAllSelected(layerageCollection, layerage.Children); } } //Remove Layerage removeLayerage = null; do { layerages.Remove(removeLayerage); removeLayerage = layerages.FirstOrDefault(layerage => layerage.Self.IsSelected == true); }while (removeLayerage != null); }
/// <summary> /// Remove all selected layerages. /// </summary> /// <param name="layerageCollection"> The layerage-collection. </param> public static void RemoveAllSelected(LayerageCollection layerageCollection) => LayerageCollection._removeAllSelected(layerageCollection, layerageCollection.RootLayerages);