private void DeleteLayer(IRenderer renderer) { var element = renderer.Element; var parent = renderer.RendererParent.Element; // Check Selected Parent if (RendererTreeHelper .FindParents <IRenderer>(renderer) .Count(r => GroupSelector.IsSelected(r as FrameworkElement)) > 0) { return; } // * Task * if (renderer is IRendererLayout lRenderer) { TaskManager?.Push( new LayoutTaskData( RendererTaskType.Remove, lRenderer, () => RemoveElement(parent, element, true), () => AddElement(parent, element, true), () => RemoveElement(parent, element))); } else if (renderer is IRendererElement eRenderer) { TaskManager?.Push( new ElementTaskData( RendererTaskType.Remove, eRenderer, () => RemoveElement(parent, element, true), () => AddElement(parent, element, true), () => RemoveElement(parent, element))); } }