//public static void ArrangeLayersBackgroundItemClick(Layerage layerage) //{ // bool hasParentsSelected = LayerageCollection._getLayersParentsIsSelected(layerage); // if (hasParentsSelected) return; // else LayerageCollection._arrangeLayersBackgroundNullParents(layerage); //} //Judge Recursive private static void _arrangeLayersBackgroundNullParents(Layerage layerage) { ILayer layer = layerage.Self; if (layer.IsSelected) { layer.Control.BackgroundMode = BackgroundMode.Selected; foreach (Layerage child in layerage.Children) { LayerageCollection._arrangeLayersBackgroundHasParentsSelected(child); } } else { bool childrenIsSelected = LayerageCollection._getLayersChildrenIsSelected(layerage); if (childrenIsSelected) { LayerageCollection._arrangeLayersBackgroundWithoutParentsSelected(layerage); } else { LayerageCollection._arrangeLayersBackgroundIsNotSelected(layerage); } } }
//Self Recursive private static void _arrangeLayersBackgroundHasParentsSelected(Layerage layerage) { ILayer layer = layerage.Self; layer.Control.BackgroundMode = BackgroundMode.ParentsSelected; foreach (Layerage child in layerage.Children) { LayerageCollection._arrangeLayersBackgroundHasParentsSelected(child); } }