/// <summary> /// Delete the node from the view-model. /// Also deletes any connections to or from the node. /// </summary> public void DeleteNode(Block node) { // // Remove all connections attached to the node. // this.Network.Connections.RemoveRange(node.AttachedConnections); // // Remove the node from the network. // this.Network.Nodes.Remove(node); }
/// <summary> /// Create a node and add it to the view-model. /// </summary> public Block CreateNode(string name, Point nodeLocation) { var node = new Block(name); node.X = nodeLocation.X; node.Y = nodeLocation.Y; // // Create the default set of four connectors. // node.Connectors.Add(new ConnectorViewModel()); node.Connectors.Add(new ConnectorViewModel()); node.Connectors.Add(new ConnectorViewModel()); node.Connectors.Add(new ConnectorViewModel()); // // Add the new node to the view-model. // this.Network.Nodes.Add(node); return node; }