Ejemplo n.º 1
0
        private Shape CreateShapeFromLine(string line)
        {
            string[] lineSplit = SplitCurrentLine();
            Shape    shape     = null;

            switch (lineSplit[0])
            {
            case "rectangle":
                shape = new BaseShape(lineSplit[0], RectangleStategy.Instance());
                break;

            case "ellipse":
                shape = new BaseShape(lineSplit[0], EllipseStrategy.Instance());
                break;

            case "group":
                shape = new ShapeComposite();
                break;

            case "ornament":
                shape = new ShapeDecorator();
                break;
            }

            return(shape);
        }
Ejemplo n.º 2
0
        private void RectangleButton_Click(object sender, EventArgs e)
        {
            Command addShape = new AddShapeCommand(shapeList, new BaseShape("rectangle", 50, 50, 50, 50, RectangleStategy.Instance()));

            history.Add(addShape);
            Invalidate();
        }