Exemple #1
0
 public bool CanCreateStudioConnection(StudioComponentOutput output, StudioComponentInput input)
 {
     return
         ((output.Component != null) && (input.Component != null) &&
          input.ConnectionType == output.ConnectionType &&
          (input.DataKind & output.DataKind) != Shared.DataKind.Nothing);
 }
 public bool CanCreateConnection(StudioComponentOutput output, StudioComponentInput input)
 {
     if (IsInputInComponents(input) && IsOutputInComponents(output))
     {
         return(connectionFactory.CanCreateStudioConnection(output, input));
     }
     return(false);
 }
 private bool IsInputInComponents(StudioComponentInput input)
 {
     foreach (var component in _components)
     {
         if (component.Inputs?.FirstOrDefault(c => c == input) != null)
         {
             return(true);
         }
     }
     return(false);
 }
 public IStudioConnection CreateConnection(StudioComponentOutput output, StudioComponentInput input)
 {
     if (IsInputInComponents(input) &&
         !_connections.Exists(c => c.Input == input) &&
         IsOutputInComponents(output))
     {
         var connection = connectionFactory.CreateStudioConnection(output, input);
         if (connection != null)
         {
             _connections.Add(connection);
             ConnectionAdded?.Invoke(this, connection);
             connection.SetTargetState(Shared.ConnectionState.Connected);
             return(connection);
         }
     }
     throw new InvalidOperationException();
 }
 private void Component_InputRemoved(object sender, StudioComponentInput input)
 {
     operationHandler.RemoveInputFromComponent(VirtualStudioName, input.Component.Id, input.Id);
 }
 private void Component_InputAdded(object sender, StudioComponentInput input)
 {
     operationHandler.AddInputToComponent(VirtualStudioName, input.Component.Id, input.ToDto());
 }
Exemple #7
0
        public IStudioConnection CreateStudioConnection(StudioComponentOutput output, StudioComponentInput input)
        {
            if (!CanCreateStudioConnection(output, input))
            {
                return(null);
            }

            return(new StudioConnection(idGenerator.GetNewId(), output, input));
        }