public static void AddShape() { Console.WriteLine(string.Format("{0}{1}{0}{2}{0}{3}{0}{4}", Environment.NewLine, "1.square", "2.rectangle", "3.circle", "4.Right triangle")); int selectedShapeNumber = int.Parse(Console.ReadLine()); shapes.Add(ShapeFactory.CreateShape(selectedShapeNumber)); }
/// <summary> /// Draw the specified shape. /// Command like: "draw rectangle (1,3) (4,8)" /// </summary> /// <param name="command"></param> private static void OnDrawShape(ICommand command) { if (!(command is DrawShapeCommand drawShapeCommand)) { return; } var shape = ShapeFactory.CreateShape(drawShapeCommand.Args.ShapeName, drawShapeCommand.Args.ShapePoints); _drawer.Draw(shape); _shapesStore.Add(shape); }