public void RemoveConnector(Connector connector)
 {
     if (connector == null)
     {
         throw new ArgumentNullException("connector");
     }
     if (this.connectors.Contains(connector))
     {
         this.OnConnectorRemoved(new ConnectorEventArgs(connector));
         connector.SetParent(null);
         this.connectors.Remove(connector);
     }
 }
        public Connector AddConnector(ConnectionPoint source, ConnectionPoint target)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (source.AssociatedDesigner == null)
            {
                throw new ArgumentException("source", SR.GetString("Error_AssociatedDesignerMissing"));
            }
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            if (target.AssociatedDesigner == null)
            {
                throw new ArgumentException("target", SR.GetString("Error_AssociatedDesignerMissing"));
            }
            FreeformActivityDesigner connectorContainer = ConnectionManager.GetConnectorContainer(source.AssociatedDesigner);

            if (this != connectorContainer)
            {
                throw new InvalidOperationException(DR.GetString("Error_AddConnector1", new object[0]));
            }
            if (((base.Activity != source.AssociatedDesigner.Activity) && !Helpers.IsChildActivity(base.Activity as CompositeActivity, source.AssociatedDesigner.Activity)) || ((base.Activity != target.AssociatedDesigner.Activity) && !Helpers.IsChildActivity(base.Activity as CompositeActivity, target.AssociatedDesigner.Activity)))
            {
                throw new ArgumentException(DR.GetString("Error_AddConnector2", new object[0]));
            }
            Connector item = this.CreateConnector(source, target);

            if (item != null)
            {
                if (this.connectors.Contains(item))
                {
                    throw new InvalidOperationException(DR.GetString("Error_AddConnector3", new object[0]));
                }
                this.connectors.Add(item);
                item.SetParent(this);
                this.OnConnectorAdded(new ConnectorEventArgs(item));
            }
            base.PerformLayout();
            return(item);
        }
 public void RemoveConnector(Connector connector)
 {
     if (connector == null)
     {
         throw new ArgumentNullException("connector");
     }
     if (this.connectors.Contains(connector))
     {
         this.OnConnectorRemoved(new ConnectorEventArgs(connector));
         connector.SetParent(null);
         this.connectors.Remove(connector);
     }
 }