Esempio n. 1
0
        public static void Main()
        {
            var async = new AsyncTimer(Console.WriteLine, 10, 1000, "Hellow world!");

            Console.WriteLine("Will print 10 times \"Hello world!\" with delay of 1000 ms:");
            async.Run();
        }
        static void Main()
        {
            AsyncTimer timer1 = new AsyncTimer(WorkFirst, 1000, 10);
            timer1.Start();

            AsyncTimer timer2 = new AsyncTimer(WorkSecond, 400, 20);
            timer2.Start();
        }
        static void Main(string[] args)
        {
            AsyncTimer printLetter = new AsyncTimer(PrintLetterOnConsole, 5, 500);
            printLetter.Execute();

            AsyncTimer printNumber = new AsyncTimer(PrintNumberOnConsole, 3, 1000);
            printNumber.Execute();
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            int ticks    = 10;
            int interval = 1000;

            Action <int> action = TimerMethod;
            AsyncTimer   timer  = new AsyncTimer(action, ticks, interval);

            timer.Execute();
        }
        static void Main(string[] args)
        {

            

            var async = new AsyncTimer(Console.WriteLine,10,1000,"Hello");
            Console.WriteLine("Will print 10 times \"Hello\"with delay of 1000ms: ");
            async.Run();
            
        }
Esempio n. 6
0
        static void Main()
        {
            AsyncTimer printGreen = new AsyncTimer(PrintGreenNumberOnConsole, 7, 2000);
            printGreen.ExecuteAction();

            AsyncTimer printRed = new AsyncTimer(PrintRedNumberOnConsole, 10, 1000);
            printRed.ExecuteAction();

            AsyncTimer beep = new AsyncTimer(MakeSound, 10, 1500);
            beep.ExecuteAction();
        }
Esempio n. 7
0
        static void Main()
        {
            Action action = () =>
            {
                Console.WriteLine("Method called");
            };

            AsyncTimer asyncTimer = new AsyncTimer(action, 7, 1000);

            asyncTimer.Run();
        }
Esempio n. 8
0
        static void Main()
        {
            var timer = new AsyncTimer(Timer_OnTick, 10, 1000);

            timer.Start();

            //test
            const int thr   = 200;
            var       count = (timer.Ticks * timer.Interval) / thr;

            for (int i = 0; i < count; i++)
            {
                Thread.Sleep(thr);
                Console.WriteLine(i);
            }
        }
Esempio n. 9
0
        static void Main(string[] args)
        {
            var async = new AsyncTimer(Console.WriteLine, 10, 1000);

            async.Run();
        }
Esempio n. 10
0
        static void Main()
        {
            AsyncTimer asyncTimer = new AsyncTimer(a => Console.WriteLine(a), 10, 1000);

            asyncTimer.Run();
        }
Esempio n. 11
0
 public static void Main()
 {
     var async = new AsyncTimer(Console.WriteLine, 10, 1000, "Hellow world!");
     Console.WriteLine("Will print 10 times \"Hello world!\" with delay of 1000 ms:");
     async.Run();
 }
 static void Main(string[] args)
 {
     var async = new AsyncTimer(Console.WriteLine, 10, 1000);
     async.Run();
 }
Esempio n. 13
0
        static void Main()
        {
            AsyncTimer timer = new AsyncTimer(Console.WriteLine, 3, 1000);

            Console.WriteLine(timer);
        }