void OnConnectionRemoved(object sender, NodeConnectionEventArgs e) { MyConnection connToDelete = e.Connection.Tag as MyConnection; if (connToDelete != null) { connToDelete.Disconnect(); } }
void OnConnectionRemoved(object sender, NodeConnectionEventArgs e) { MyConnection connToDelete = e.Connection.Tag as MyConnection; if (connToDelete != null) { connToDelete.Disconnect(); m_mainForm.ProjectStateChanged("Connection removed"); } m_mainForm.RefreshConnections(this); }
void OnConnectionDoubleClick(object sender, NodeConnectionEventArgs e) { e.Connection.Name = "Connection " + counter++; }
private void OnConnectionRemoved(object sender, NodeConnectionEventArgs e) { var connection = e.Connection.Tag as Connection; connection?.Disconnect(); }
public void OnConnectionRemoved() { //Arrange var sourceNodeId = Guid.NewGuid(); var targetNodeId = Guid.NewGuid(); var eventArgs = new NodeConnectionEventArgs {SourceNodeId = sourceNodeId, TargetNodeId = targetNodeId}; //Act _form.OnConnectionRemoved(null, eventArgs); //Assert _mockPresenter.Verify(p => p.RemoveConnection(sourceNodeId, targetNodeId)); }
public void OnConnectionAdded_NewConnection() { //Arrange var sourceNodeId = Guid.NewGuid(); var targetNodeId = Guid.NewGuid(); var eventArgs = new NodeConnectionEventArgs { SourceNodeId = sourceNodeId, TargetNodeId = targetNodeId }; _mockPresenter.Setup(p => p.AddConnection(sourceNodeId, targetNodeId)).Returns(true); //Act _form.OnConnectionAdded(null, eventArgs); //Assert _mockFormInteractionHelper.Verify( f => f.ShowMessage(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<MessageBoxButtons>()), Times.Never()); _mockMapControl.Verify(m => m.StopNodeConnector()); }
public void OnConnectionAdded_ConnectionAlreadyExists() { //Arrange var sourceNodeId = Guid.NewGuid(); var targetNodeId = Guid.NewGuid(); var eventArgs = new NodeConnectionEventArgs {SourceNodeId = sourceNodeId, TargetNodeId = targetNodeId}; _mockPresenter.Setup(p => p.AddConnection(sourceNodeId, targetNodeId)).Returns(false); //Act _form.OnConnectionAdded(null, eventArgs); //Assert _mockFormInteractionHelper.Verify(f => f.ShowMessage("Connection already exists between those nodes.", "Existing Connection", MessageBoxButtons.OK)); _mockMapControl.Verify(m => m.StopNodeConnector()); }
//TODO: create unit tests public void OnNodeConnect(object sender, EventArgs e) { var nodeControl = (NodeControl) sender; if (_CurrentConnector == null) { _CurrentConnector = new Connector(this); _CurrentConnector.Delete += OnConnectorDelete; _CurrentConnector.SetSourceNode(nodeControl); } else { _CurrentConnector.SetTargetNode(nodeControl); Controls.Add(_CurrentConnector); if (ConnectionAdded != null) { var eventArgs = new NodeConnectionEventArgs { SourceNodeId = _CurrentConnector.SourceNodeId, TargetNodeId = _CurrentConnector.TargetNodeId }; ConnectionAdded(this, eventArgs); } StopNodeConnector(); } }
public void OnConnectorDelete(object sender, EventArgs e) { var connection = (Connector) sender; if (ConnectionRemoved != null) { var eventArgs = new NodeConnectionEventArgs { SourceNodeId = connection.SourceNodeId, TargetNodeId = connection.TargetNodeId }; ConnectionRemoved(this, eventArgs); } connection.Dispose(); Controls.Remove(connection); }
public void OnConnectionRemoved(object sender, NodeConnectionEventArgs e) { _presenter.RemoveConnection(e.SourceNodeId, e.TargetNodeId); }
public void OnConnectionAdded(object sender, NodeConnectionEventArgs e) { if (!_presenter.AddConnection(e.SourceNodeId, e.TargetNodeId)) { _formInteractionHelper.ShowMessage("Connection already exists between those nodes.", "Existing Connection", MessageBoxButtons.OK); } StopConnector(); }