/// <summary> /// Draws the line on canvas. /// </summary> /// <param name="canvas">The canvas.</param> /// <param name="tokens">The tokens.</param> public void DrawLineOnCanvas(Canvas canvas, string[] tokens) { try { Point[] points = GetPoints(canvas, tokens, 2); if ((points[0].X == points[1].X) || (points[0].Y == points[1].Y)) { // Change position of the points if the first one is greater that the first Point.ReOrderPoints(points[0], points[1]); CanvasRenderer.DrawLine(points[0], points[1]); CanvasRenderer.Draw(); } else { OutputWriter.SendToOutput("A line can't be drawn with the above points", true); } } catch (InvalidPointException invalidPointException) { OutputWriter.SendToOutput(invalidPointException.Message, true); } }