Example #1
0
        static void Main(string[] args)
        {
            var timer = new MyTimer() { Interval_ms = Interval_ms };
            timer.Tick += timer_Tick;
            timer.Start();

			var manualResetEvent = new ManualResetEvent(initialState: false);
            while (manualResetEvent.WaitOne(Interval_ms) == false)
                Thread.Yield();
        }
Example #2
0
        static void Main(string[] args)
        {
            MyTimer t = new MyTimer(increment);

            t.interval = 1000;
            string op = "";

            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 another key to end.");
                op = Console.ReadLine();
            } while (op == "1");
        }