Пример #1
0
        private void btnDraw_Click(object sender, EventArgs e)
        {
            string[]    commands = txtCommands.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToArray();
            DrawingTool dt       = new DrawingTool();

            txtOutput.Text = dt.Draw(commands);
        }
    public static void Main()
    {
        var    input  = Console.ReadLine();
        Figure figure = null;

        switch (input.ToLower())
        {
        case "square":
            int width = int.Parse(Console.ReadLine());
            figure = new Square(width);
            break;

        case "rectangle":
            int rWidth  = int.Parse(Console.ReadLine());
            int rHeight = int.Parse(Console.ReadLine());
            figure = new Rectangle(rWidth, rHeight);
            break;

        default:
            break;
        }
        var tool = new DrawingTool(figure);

        tool.Draw();
    }
Пример #3
0
 private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     DrawingTool = new DrawingTool(InputFilePath, OutputFolderPath);
     DrawingTool.DrawingCommandExecuted += (senderDrawing, eDrawing) =>
     {
         Dispatcher.Invoke(() => {
             AddLogMessage(new Log(DateTime.Now.ToString(DATETIME_FULL_FORMAT), $"Command {eDrawing.CommandName} - {eDrawing.CommandLine} was executed.", "INFO"));
         });
     };
     DrawingTool.Draw();
     //Thread.Sleep(5000);
 }
Пример #4
0
    public static void Main()
    {
        var shape = Console.ReadLine();
        var width = int.Parse(Console.ReadLine());
        int height;

        height = shape == "Square" ? width : int.Parse(Console.ReadLine());

        var figure = new DrawingTool(width, height);

        Console.WriteLine(figure.Draw());
    }
Пример #5
0
        public void DrawingWrongData()
        {
            DrawingTool cnv = new DrawingTool();

            string result = string.Empty;

            string[] commands = new string[5];
            commands[0] = "C 20 30";
            commands[1] = "L 1 2 6 2";
            commands[2] = "L 6 3 25 4";
            commands[3] = "R 16 1 20 50";
            commands[4] = "B 1 1";

            Console.WriteLine(cnv.Draw(commands));
        }
Пример #6
0
        public void DrawingValidData()
        {
            DrawingTool cnv = new DrawingTool();

            string result = string.Empty;

            string[] commands = new string[5];
            commands[0] = "C 20 4";
            commands[1] = "L 1 2 6 2";
            commands[2] = "L 6 3 6 4";
            commands[3] = "R 16 1 20 3";
            commands[4] = "B 10 3 o";

            Console.WriteLine(cnv.Draw(commands));
        }
Пример #7
0
        static void Main(string[] args)
        {
            var shape  = Console.ReadLine();
            var width  = int.Parse(Console.ReadLine());
            var height = 0;

            if (shape == "Square")
            {
                height = width;
            }
            else
            {
                height = int.Parse(Console.ReadLine());
            }
            var figure = new DrawingTool(height, width);

            Console.WriteLine(figure.Draw());
        }
Пример #8
0
    static void Main()
    {
        string figureType = Console.ReadLine();

        if (figureType == "Square")
        {
            int         squareLength = int.Parse(Console.ReadLine());
            Square      square       = new Square(squareLength);
            DrawingTool dt           = new DrawingTool(square);
            dt.Draw();
        }
        else if (figureType == "Rectangle")
        {
            int         rectangleWidth  = int.Parse(Console.ReadLine());
            int         rectangleHeight = int.Parse(Console.ReadLine());
            Rectangle   rectangle       = new Rectangle(rectangleWidth, rectangleHeight);
            DrawingTool dt = new DrawingTool(rectangle);
            dt.Draw();
        }
    }
    public static void Main()
    {
        string figure = Console.ReadLine();

        Shape shape = null;

        if (figure == "Square")
        {
            int side = int.Parse(Console.ReadLine());

            shape = new Square(side);
        }
        else if (figure == "Rectangle")
        {
            int width  = int.Parse(Console.ReadLine());
            int height = int.Parse(Console.ReadLine());

            shape = new Rectangle(width, height);
        }

        DrawingTool drawingTool = new DrawingTool(shape);

        drawingTool.Draw();
    }