public string BuildDiagram(List <Method> allMethods, bool closeAfterBuild, string diagramFilepath) { try { VisioManipulator.OpenDocument(); } catch { VisioManipulator.AbortOpenDocument(); throw; } var currentPos = new Point(StartX, StartY); foreach (var method in allMethods) { if (method.MethodType == MethodType.COMMON) { VisioManipulator.DropTextField(method.MethodSignature, currentPos); currentPos.Offset(0, -0.4); } var initShape = VisioManipulator.DropSimpleShape("", new Point(currentPos.X, currentPos.Y - 0.25), ShapeForm.INIT_SHAPE); var treeContext = new BranchContext(null, initShape, initShape); foreach (var node in method.MethodNodes) { treeContext = BuildTree(node, treeContext); treeContext = new BranchContext(null, treeContext.LastBranchShape, treeContext.ShapeToContinueThree, NodesBranchRelation.OTHER_BRANCH); } MoveCordsToNextMethod(currentPos); } string diagramFilename; if (closeAfterBuild) { diagramFilename = VisioManipulator.CloseDiagramDocument(diagramFilepath); } else { diagramFilename = VisioManipulator.SaveDiagramDocument(diagramFilepath); } return(diagramFilename); }
private void PlaceTextField(string text, Point point) { VisioManipulator.DropTextField(text, point); }