コード例 #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);
 }
コード例 #2
0
 public bool CanCreateConnection(StudioComponentOutput output, StudioComponentInput input)
 {
     if (IsInputInComponents(input) && IsOutputInComponents(output))
     {
         return(connectionFactory.CanCreateStudioConnection(output, input));
     }
     return(false);
 }
コード例 #3
0
 private bool IsInputInComponents(StudioComponentInput input)
 {
     foreach (var component in _components)
     {
         if (component.Inputs?.FirstOrDefault(c => c == input) != null)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #4
0
 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();
 }
コード例 #5
0
 private void Component_InputRemoved(object sender, StudioComponentInput input)
 {
     operationHandler.RemoveInputFromComponent(VirtualStudioName, input.Component.Id, input.Id);
 }
コード例 #6
0
 private void Component_InputAdded(object sender, StudioComponentInput input)
 {
     operationHandler.AddInputToComponent(VirtualStudioName, input.Component.Id, input.ToDto());
 }
コード例 #7
0
        public IStudioConnection CreateStudioConnection(StudioComponentOutput output, StudioComponentInput input)
        {
            if (!CanCreateStudioConnection(output, input))
            {
                return(null);
            }

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