private void DeleteInternalLayer(int position) { InternalLayerDisplay display = internalLayerDisplays[position]; AddInternalLayerButton button = addLayerButtons[position + 1]; internalLayerDisplays.Remove(display); addLayerButtons.Remove(button); InternalLayersPanel.Children.Remove(display); InternalLayersPanel.Children.Remove(button); internalLayerDisplays.GetRange(position, internalLayerDisplays.Count - position).ForEach(x => x.Position--); if (addLayerButtons.Count > position + 1) { addLayerButtons.GetRange(position + 1, addLayerButtons.Count - position).ForEach(x => x.Position--); } }
private void AddAddInternalLayerButton(int pos) { addLayerButtons.GetRange(pos, internalLayerDisplays.Count - pos).ForEach((x) => x.Position++); int positionToPlaceAddButton = pos * 2; AddInternalLayerButton button = new AddInternalLayerButton(AddInternalLayer, pos); if (positionToPlaceAddButton == InternalLayersPanel.Children.Count) { InternalLayersPanel.Children.Add(button); addLayerButtons.Add(button); } else { InternalLayersPanel.Children.Insert(positionToPlaceAddButton, button); addLayerButtons.Insert(pos, button); } }