/// <summary>
        /// A function to conveniently populate the view-model with test data.
        /// </summary>
        private void PopulateWithTestData()
        {
            //
            // Create a network, the root of the view-model.
            //
            this.Network = new NetworkViewModel();

            //
            // Create some nodes and add them to the view-model.
            //
            var node1 = CreateNode("Test Node1", new Point(100, 60), false, true, true);
            var node2 = CreateNode("Test Node2", new Point(350, 80), false, true, true);

            //
            // Create a connection between the nodes.
            //
            AConnectionViewModel connection = new StandardConnectionViewModel
            {
                SourceConnector = node1.OutputConnectors[0],
                DestConnector   = node2.InputConnectors[0]
            };

            AConnectionViewModel pathconnection = new PathConnectionViewModel
            {
                SourceConnector = node1.RightNodeConnection,
                DestConnector   = node2.LeftNodeConnection
            };

            //
            // Add the connection to the view-model.
            //
            this.Network.Connections.Add(connection);
            this.Network.Connections.Add(pathconnection);
        }
        /// <summary>
        /// Called when the user has started to drag out a connector, thus creating a new connection.
        /// </summary>
        public AConnectionViewModel ConnectionDragStarted(ConnectorViewModel draggedOutConnector, Point curDragPoint)
        {
            //
            // Create a new connection to add to the view-model.
            //
            AConnectionViewModel connection;

            if (draggedOutConnector.Type == ConnectorType.Path)
            {
                connection = new PathConnectionViewModel();
            }
            else
            {
                connection = new StandardConnectionViewModel();
            }

            switch (draggedOutConnector.Type)
            {
            case ConnectorType.Undefined:
                break;

            case ConnectorType.Input:
            {
                //
                // The user is dragging out a destination connector (an input) and will connect it to a source connector (an output).
                //
                connection.DestConnector          = draggedOutConnector;
                connection.SourceConnectorHotspot = curDragPoint;
            }
            break;

            case ConnectorType.Output:
            {
                //
                // The user is dragging out a source connector (an output) and will connect it to a destination connector (an input).
                //
                connection.SourceConnector      = draggedOutConnector;
                connection.DestConnectorHotspot = curDragPoint;
            }
            break;

            case ConnectorType.Path:
            {
                //
                // The user is dragging out a path connector.
                //
                if (draggedOutConnector.Name == NodeViewModel.DefaultLeftNodeConnectorName)
                {
                    connection.DestConnector          = draggedOutConnector;
                    connection.SourceConnectorHotspot = curDragPoint;
                }
                else
                {
                    connection.SourceConnector      = draggedOutConnector;
                    connection.DestConnectorHotspot = curDragPoint;
                }
            }
            break;

            default:
                break;
            }

            //
            // Add the new connection to the view-model.
            //
            this.Network.Connections.Add(connection);

            return(connection);
        }