private Dictionary<DataVertex, Point> GenerateRandomVertices(GraphExample graph, int index, int count, int minX, int maxX, int minY, int maxY) { var list = graph.Vertices.ToList(); var vertexPositions = new Dictionary<DataVertex, Point>(); for (var i = index; i < index + count; i++) { var vertex = list[i]; var vc = new VertexControl(vertex); erg_Area.AddVertex(vertex, vc); vertexPositions[vertex] = new Point(ShowcaseHelper.Rand.Next(minX, maxX), ShowcaseHelper.Rand.Next(minY, maxY)); vc.SetPosition(vertexPositions[vertex]); } return vertexPositions; }
void Graph_VertexAdded( YodiiGraphVertex vertex ) { var control = new VertexControl( vertex ); if( vertex.IsService ) { if( vertex.LabServiceInfo.ServiceInfo.PositionInGraph.IsValid() ) control.SetPosition( vertex.LabServiceInfo.ServiceInfo.PositionInGraph ); } else if( vertex.IsPlugin ) { if( vertex.LabPluginInfo.PluginInfo.PositionInGraph.IsValid() ) control.SetPosition( vertex.LabPluginInfo.PluginInfo.PositionInGraph ); } GraphArea.AddVertex( vertex, control ); DragBehaviour.SetUpdateEdgesOnMove( control, true ); }