/// <summary> /// Event raised then Connections have been removed. /// </summary> private void connections_ItemsRemoved(object sender, CollectionItemsChangedEventArgs e) { foreach (ConnectionViewModel connection in e.Items) { connection.SourceConnector = null; connection.DestConnector = null; } }
/// <summary> /// Event raised when connections have been removed from the connector. /// </summary> private void attachedConnections_ItemsRemoved(object sender, CollectionItemsChangedEventArgs e) { foreach (ConnectionViewModel connection in e.Items) { connection.ConnectionChanged -= new EventHandler<EventArgs>(connection_ConnectionChanged); } if (AttachedConnections.Count == 0) { // // No longer connected to anything, notify the data-binding system that // 'IsConnected' should be re-evaluated. // OnPropertyChanged("IsConnectionAttached"); OnPropertyChanged("IsConnected"); } }
/// <summary> /// Debug checking to ensure that no connection is added to the list twice. /// </summary> private void attachedConnections_ItemsAdded(object sender, CollectionItemsChangedEventArgs e) { foreach (ConnectionViewModel connection in e.Items) { connection.ConnectionChanged += new EventHandler<EventArgs>(connection_ConnectionChanged); } if ((AttachedConnections.Count - e.Items.Count) == 0) { // // The first connection has been added, notify the data-binding system that // 'IsConnected' should be re-evaluated. // OnPropertyChanged("IsConnectionAttached"); OnPropertyChanged("IsConnected"); } }
/// <summary> /// Event raised when connectors are removed from the node. /// </summary> private void outputConnectors_ItemsRemoved(object sender, CollectionItemsChangedEventArgs e) { foreach (ConnectorViewModel connector in e.Items) { connector.ParentNode = null; connector.Type = ConnectorType.Undefined; } }
/// <summary> /// Event raised when connectors are added to the node. /// </summary> private void outputConnectors_ItemsAdded(object sender, CollectionItemsChangedEventArgs e) { foreach (ConnectorViewModel connector in e.Items) { connector.ParentNode = this; connector.Type = ConnectorType.Output; } }
/// <summary> /// Event raised when connectors are removed from the node. /// </summary> private void connectors_ItemsRemoved(object sender, CollectionItemsChangedEventArgs e) { foreach (ConnectorViewModel connector in e.Items) { connector.ParentNode = null; } }
/// <summary> /// Event raised when connectors are added to the node. /// </summary> private void allConnectors_ItemsAdded(object sender, CollectionItemsChangedEventArgs e) { foreach (ConnectorViewModel connector in e.Items) { connector.ParentNode = this; } }