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); }
private void EllipseButton_Click(object sender, EventArgs e) { Command addShape = new AddShapeCommand(shapeList, new BaseShape("ellipse", 50, 50, 50, 50, EllipseStrategy.Instance())); history.Add(addShape); Invalidate(); }