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); }
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); } }
public virtual void AddConnectionTo(Connection connection) { ConnectionsTo.Add(connection); }