Esempio n. 1
0
        public void Remove()
        {
            foreach (var connection in ConnectionsFrom)
            {
                // remove shapes
                connection.RemoveFromUICollection((Parent as Canvas).Children);
                // remove connection from connected element
                connection.Left.RemoveConnection(connection);
                // remove connection from global list
                Workspace.Connections.Remove(connection);
            }

            foreach (var connection in ConnectionsTo)
            {
                // remove shapes
                connection.RemoveFromUICollection((Parent as Canvas).Children);
                // remove connection from connected element
                connection.Right.RemoveConnection(connection);
                // remove connection from global list
                Workspace.Connections.Remove(connection);
            }

            // remove all connections
            ConnectionsFrom.Clear();
            ConnectionsTo.Clear();

            // remove user control
            (Parent as Canvas).Children.Remove(this);
        }
Esempio n. 2
0
        public virtual void RemoveConnection(Connection connection)
        {
            if (ConnectionsTo.Remove(connection))
            {
                HilightOutputAnchorOffByName(connection.LeftAnchorName);
            }

            if (ConnectionsFrom.Remove(connection))
            {
                // set right input value to null
                var rightProperty = NodeInstance.GetType().GetProperty(connection.RightPropertyName);
                if (rightProperty != null)
                {
                    rightProperty.SetValue(NodeInstance, null);
                }

                EnableInputElement(connection.RightAnchorName);
                HilightInputAnchorOffByName(connection.RightAnchorName);
            }
        }
Esempio n. 3
0
 public virtual void AddConnectionTo(Connection connection)
 {
     ConnectionsTo.Add(connection);
 }