コード例 #1
0
        public static List <RadDiagramShape> CreateDivisionBranch(this RadDiagram diagram, string name)
        {
            var shapes   = new List <RadDiagramShape>();
            var director = diagram.CreateShape(name + " director");

            shapes.Add(director);
            var manCount = Rand.Next(2, 4);

            for (var j = 0; j < manCount; j++)
            {
                var man = diagram.CreateShape(name + " manager");
                shapes.Add(man);
                man.Geometry   = ShapeFactory.GetShapeGeometry(CommonShapeType.EllipseShape);
                man.Background = new SolidColorBrush(Colors.Brown);
                var devCount = Rand.Next(3, 6);
                diagram.AddConnection(director, man, ConnectorPosition.Bottom, ConnectorPosition.Top);
                for (var k = 0; k < devCount; k++)
                {
                    var dev = diagram.CreateShape("Dev " + k);
                    shapes.Add(dev);
                    dev.Background = new SolidColorBrush(Colors.LightGray);
                    diagram.Connect(man, dev);
                }
            }
            return(shapes);
        }