private void AddOrReplaceConnection() { if (DesignMode) { var connection = new Connection(SelectionService.Input, SelectionService.Output); var selector = CurrentProject.Connections.FirstOrDefault( x => x.FromInputOutput.InputOutput == connection.FromInputOutput.InputOutput); if (selector != null) { CurrentProject.RemoveConnection(selector); } CurrentProject.AddConnection(connection); } }