internal void MoveOperatorTo(Guid opIdToMove, Guid newParentId) { var opToMove = InternalOps.Single(op => op.ID == opIdToMove); var newParent = InternalOps.Single(op => op.ID == newParentId); RemoveOperatorInternal(opToMove, disposeOpResources: false); newParent.AddOperator(opToMove); }
public void Dispose() { Inputs.ForEach(i => i.Dispose()); Outputs.ForEach(o => o.Dispose()); InternalOps.ForEach(o => o.Dispose()); InternalParts.ForEach(p => p.Dispose()); Definition.RemoveInstance(this); }
internal void ReplaceConnectionAt(Connection connection) { // first extract prev connection that should be replaced var prevSourceOpPart = connection.TargetOpPart.Connections[connection.Index]; var opResult = InternalOps.Find(op => op.Outputs.Exists(opPart => opPart == prevSourceOpPart)); var prevSourceOp = opResult ?? this; RemoveConnection(new Connection(prevSourceOp, prevSourceOpPart, connection.TargetOp, connection.TargetOpPart, connection.Index)); InsertConnectionAt(connection); }
internal void RemoveOperatorInternal(Operator op, bool disposeOpResources) { InternalOps.Remove(op); EventExt.Raise(OperatorRemovedEvent, this, new OperatorChangedEventArgs(op)); if (disposeOpResources) { op.Dispose(); // clean up all resources locked by op } }
internal void AddOperator(Operator op) { InternalOps.Add(op); op.Parent = this; EventExt.Raise(OperatorAddedEvent, this, new OperatorChangedEventArgs(op)); }