public void DeleteElement(BaseElement el) { if ((el != null) && !(el is ConnectorElement)) { //Delete link if (el is BaseLinkElement) { BaseLinkElement lnk = (BaseLinkElement)el; DeleteLink(lnk); return; } //Delete node if (el is NodeElement) { NodeElement conn = ((NodeElement)el); foreach (ConnectorElement elconn in conn.Connectors) { BaseLinkElement lnk; for (int i = elconn.Links.Count - 1; i >= 0; i--) { lnk = (BaseLinkElement)elconn.Links[i]; DeleteLink(lnk); } } if (selectedNodes.Contains(el)) { selectedNodes.Remove(el); } } if (SelectedElements.Contains(el)) { selectedElements.Remove(el); } elements.Remove(el); OnAppearancePropertyChanged(new EventArgs()); } el = null; }
internal void RemoveLink(BaseLinkElement lnk) { links.Remove(lnk); }