public Operator(Guid id, MetaOperator metaOp, List <OperatorPart> inputs, List <OperatorPart> outputs, List <Operator> internalOps, List <OperatorPart> internalParts) { ID = id; Definition = metaOp; Inputs = inputs; Outputs = outputs; InternalOps = internalOps; InternalParts = internalParts; Name = ""; Position = new Point(100, 100); Width = 75; // This should be Grid.Size * 3 UpdateOutputIndices(); // Forward Modified-events of parameters as Manipulated-Event foreach (var opPart in Inputs.Union(Outputs).Union(InternalParts)) { opPart.Parent = this; opPart.ManipulatedEvent += (o, a) => EventExt.Raise(ModifiedEvent, this, EventArgs.Empty); } foreach (var op in InternalOps) { op.Parent = this; } ConnectTypeChangedHanderWith(Inputs); }
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 InsertInput(int index, OperatorPart input) { if ((index < 0) || (index > Inputs.Count)) { throw new IndexOutOfRangeException(); } Inputs.Insert(index, input); input.Parent = this; EventExt.Raise(InputAddedEvent, this, new OperatorPartChangedEventArgs(input)); }
internal void InsertOutput(int index, OperatorPart output) { if ((index < 0) || (index > Outputs.Count)) { throw new IndexOutOfRangeException(); } Outputs.Insert(index, output); output.Parent = this; UpdateOutputIndices(); EventExt.Raise(OutputAddedEvent, this, new OperatorPartChangedEventArgs(output)); }
internal void RemoveInputInternal(OperatorPart input) { var inputOp = input.Parent; var parentOp = inputOp.Parent; // remove possible connection to this input in parent op if (parentOp != null) { while (input.Connections.Count > 0) { var sourceOpPart = input.Connections[0]; var sourceOp = sourceOpPart.Parent; var connection = new Connection(sourceOp, sourceOpPart, this, input, 0); parentOp.RemoveConnection(connection); } } Inputs.Remove(input); EventExt.Raise(InputRemovedEvent, this, new OperatorPartChangedEventArgs(input)); }
internal void RemoveOutputInternal(OperatorPart output) { var outputOp = this; var parentOp = outputOp.Parent; // remove possible connection from this output in parent op if (parentOp != null) { var connectionsToRemove = (from con in parentOp.Connections where con.SourceOp == outputOp where con.SourceOpPart == output select con).ToList(); foreach (var connection in connectionsToRemove) { parentOp.RemoveConnection(connection); } } Outputs.Remove(output); UpdateOutputIndices(); EventExt.Raise(OutputRemovedEvent, this, new OperatorPartChangedEventArgs(output)); }
internal void TriggerOperatorPartStateChanged(OperatorPartStateChangedEventArgs args) { EventExt.Raise(OperatorPartStateChangedEvent, this, args); }
protected void TriggerDisabledEvent() { EventExt.Raise(DisabledEvent, this, EventArgs.Empty); }
internal void TriggerVisibleChanged(VisibleChangedEventArgs args) { EventExt.Raise(VisibleChangedEvent, this, args); }
internal void TriggerWidthChanged(WidthChangedEventArgs args) { EventExt.Raise(WidthChangedEvent, this, args); }
internal void TriggerPositionChanged(PositionChangedEventArgs args) { EventExt.Raise(PositionChangedEvent, this, args); }
private void TriggerConnectionRemoved(ConnectionChangedEventArgs args) { EventExt.Raise(ConnectionRemovedEvent, this, args); }
internal void AddOperator(Operator op) { InternalOps.Add(op); op.Parent = this; EventExt.Raise(OperatorAddedEvent, this, new OperatorChangedEventArgs(op)); }