static void Main(string[] args) { Console.WriteLine("Enter the number of times for the repeated action:"); int ticks = int.Parse(Console.ReadLine()); Console.WriteLine("Enter the interval between repetitions(in milliseconds):"); double interval = double.Parse(Console.ReadLine()); Console.WriteLine("Press the 'Esc' key if you want to stop the program!"); Action act = TimerMethod; AsyncTimer timer = new AsyncTimer(act, ticks, interval); timer.Run(); int i = 1; while (true) { if (Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape) { break; } Console.WriteLine("I'm an unstopable Main method {0}", i++); } }
public static void Main(string[] args) { var firstTimer = new AsyncTimer(Test1, 5, 500); var secondTimer = new AsyncTimer(Test2, 5, 1000); firstTimer.Run(); secondTimer.Run(); }
public static void Main() { Action f = testMethod;; AsyncTimer test = new AsyncTimer(f, 10, 500); test.Run(); string testString = Console.ReadLine(); }
static void Main() { AsyncTimer randomNumberPerSecond = new AsyncTimer(RandomNumber, 10, 1000); AsyncTimer newLine = new AsyncTimer(AddNewLine, 1, 11000); randomNumberPerSecond.Run(); newLine.Run(); }
public static void Main() { Action f = testMethod; ; AsyncTimer test = new AsyncTimer(f, 10, 500); test.Run(); string testString = Console.ReadLine(); }
static void Main() { Action<string> action = Print; int ticks = 50; int t = 1000; AsyncTimer AsyncTimerObj = new AsyncTimer(action, ticks, t); AsyncTimerObj.Run("hello!!!"); }