Exemplo n.º 1
0
 /// <summary>
 /// Connects elements using a dictionary that describes the inputs for each Shape.
 /// </summary>
 /// <param name="elementAndItsInputs"></param>
 private void connectEverything(Dictionary <Sketch.Shape, Dictionary <int, Tuple <Shape, int> > > elementAndItsInputs)
 {
     foreach (var shapeAndInputs in elementAndItsInputs)
     {
         Shape rightShape = shapeAndInputs.Key;
         var   inputPorts = shapeAndInputs.Value;
         foreach (var inputPort in inputPorts)
         {
             CircuitElement rightElement = shapesToElements[rightShape];
             int            rightIndex   = inputPort.Key;
             CircuitElement leftElement  = shapesToElements[inputPort.Value.Item1];
             int            leftIndex    = inputPort.Value.Item2;
             rightElement.addInput(sourceElement: leftElement, sourceIndex: leftIndex, destIndex: rightIndex);
         }
     }
 }