private static void Main() { do { Console.Clear(); // Get x and y. var x = GetNumber <double>("Input X: "); var y = GetNumber <double>("Input Y: "); Console.WriteLine(); // Create new dot. var D = new Dot(x, y); D.OnCoordChanged += PrintInfo; D.DotFlow(); PrintMessage("Press ESC for exit, press any other key for repeat solution", ConsoleColor.Green); } while (Console.ReadKey().Key != ConsoleKey.Escape); }
private static void Main(string[] args) { do { try { Console.Write("Enter x: "); double x = double.Parse(Console.ReadLine() ?? throw new ArgumentNullException("Input was null")); Console.Write("Enter y: "); double y = double.Parse(Console.ReadLine() ?? throw new ArgumentNullException("Input was null")); Dot d = new Dot(x, y); d.OnCoordChanged += PrintInfo; d.DotFlow(); } catch (Exception e) { Console.WriteLine(e.Message); } Console.WriteLine("Press Esc to exit or another button to continue"); } while (Console.ReadKey().Key != ConsoleKey.Escape); }