static void Main(string[] args) { MyTimer t = new MyTimer(increment); t.intervalo = 1000; // Una funciĆ³n se ejecuta cada 1s string opcion = ""; do { Console.WriteLine("Press any key to start."); Console.ReadKey(); t.run(); Console.WriteLine("Press any key to pause."); Console.ReadKey(); t.pause(); Console.WriteLine("Press 1 to restart or Enter to end."); opcion = Console.ReadLine(); } while (opcion == "1"); }
static void Main(string[] args) { MyTimer t = new MyTimer(increment); t.Interval = 1000; string op = ""; Console.WriteLine("Press any key to start"); Console.ReadKey(); do { t.star(); Console.Clear(); Console.WriteLine("Press any key to stop"); Console.ReadKey(); t.stop(); Console.Clear(); pintarCounter(); Console.WriteLine("Press 1 to continue or Enter to end"); op = Console.ReadLine(); Console.Clear(); pintarCounter(); } while (op == "1"); }