public void CreateTriangle() { int sides = 0; Console.WriteLine("Enter the side of the triangle."); Console.WriteLine(); Console.Write("Sides: "); sides = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(); Triangle triangle = new Triangle(); triangle.SetTriangle(sides); char[,] matrixTri = triangle.Tri(); MoveImage MoveImg = new MoveImage(); MoveImg.SetMoveImage(matrixTri, sides, sides); MoveImg.Moveimage(); }
public void CreateRectangle() { int height = 0, width = 0; Console.WriteLine("Enter height and width of the rectangle."); Console.WriteLine(); Console.Write("Height: "); height = Convert.ToInt32(Console.ReadLine()); Console.Write("Width: "); width = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(); Rectangle rectangle = new Rectangle(); rectangle.SetRectangle(height, width); char[,] matrixRect = rectangle.Rect(); MoveImage MoveImage = new MoveImage(); MoveImage.SetMoveImage(matrixRect, height, width); MoveImage.Moveimage(); }
public static void Main(string[] args) { Console.Write("Input console color: "); string foregroundColor = Console.ReadLine(); ColorForConsole consoleColor = new ColorForConsole(foregroundColor); consoleColor.SelectConsoleColor(); Console.Write("Choose your image type(1-Rectangle, 2-Triangle): "); string str = Console.ReadLine(); bool selected = int.TryParse(str, out int type); if (selected) { IFigureBuilder figureBuilder = null; var figureType = (Figures)type; IShape shape; MoveImage moveImage; if (figureType == Figures.Rectangle) { figureBuilder = new RectangleBuilder(); } else if (figureType == Figures.Triangle) { figureBuilder = new TriangleBuilder(); } shape = figureBuilder.Create(); moveImage = new MoveImage(shape); moveImage.MoveImg(); } else if (!selected) { Console.WriteLine("There is no such type."); } }