Contains() public method

public Contains ( BaseElement element ) : bool
element BaseElement
return bool
Example #1
0
        public void DeleteLink(BaseLinkElement lnk)
        {
            if (lnk != null)
            {
                lnk.Connector1.RemoveLink(lnk);
                lnk.Connector2.RemoveLink(lnk);

                if (elements.Contains(lnk))
                {
                    elements.Remove(lnk);
                }
                if (selectedElements.Contains(lnk))
                {
                    selectedElements.Remove(lnk);
                }
                OnAppearancePropertyChanged(new EventArgs());
            }
        }
Example #2
0
        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;
        }