void mDefaultPage_OnEntityRemoved(object sender, EntityEventArgs e) { if (mPaintables.Contains(e.Entity)) { //shift the entities above the one to be removed int index = e.Entity.SceneIndex; foreach (IDiagramEntity entity in mPaintables) { if (entity.SceneIndex > index) { entity.SceneIndex--; } } mPaintables.Remove(e.Entity); } //if the selection contains the shape we have to remove it from the selection if (Selection.SelectedItems.Contains(e.Entity)) { Selection.SelectedItems.Remove(e.Entity); } RaiseOnEntityRemoved(e); }
public void DetachConnector(IConnector connector) { if (connector == null) { return; } if (attachedConnectors.Contains(connector)) { attachedConnectors.Remove(connector); connector.AttachedTo = null; } }