Пример #1
0
 static void Main()
 {
     _dateUpdateTimer = new Timer(5);
     _dateUpdateTimer.Callback += Do;
     _dateUpdateTimer.Start();
     Console.WriteLine("Timer started!");
 }
Пример #2
0
        static void Main(string[] args)
        {
            Timer timer = new Timer();
            TimerListener listener = new TimerListener();

            listener.Subscribe(timer);
            timer.DoStuffEveryTTicks(190000);
        }
Пример #3
0
        static void Main()
        {
            Timer timer = new Timer(5);

            timer.SomeMethods += FirstTestMethod;
            timer.SomeMethods += SecondTestMethod;

            timer.ExecuteMethods();
        }
Пример #4
0
        static void Main()
        {
            var timer = new Timer(9);

            timer.Methods = Tick;
            timer.Methods += Tock;

            timer.ExecuteMethods();
        }
Пример #5
0
        public static void Starting(int interval, int stopMilliSeconds)
        {
            Timer timer = new Timer(interval);

            Execute execute = Timer.PrintSeconds;

            while (timer.MilliSeconds < stopMilliSeconds)
            {
                execute(timer);
                timer.MilliSeconds += interval;
                System.Threading.Thread.Sleep(interval);
            }
        }
Пример #6
0
 static void Main()
 {
     try
     {
         Timer timer = new Timer(3);
         timer.execute += PrintStars;
         timer.execute += PrintPlus;
         timer.Run();
     }
     catch (Exception e)
     {
         Console.Error.WriteLine(e.Message);
     }
 }
Пример #7
0
 static void Main()
 {
     Timer testTimer = new Timer(2);
     Console.WriteLine("Executing method \"DateNow\" every four seconds:");
     testTimer.ExecuteMethod(DateNow);
 }
Пример #8
0
 public void Subscribe(Timer t)
 {
     t.TimerExpired += new Timer.TimerEventHandler(OnEventMethod);
 }
Пример #9
0
 public static void PrintSeconds(Timer timer)
 {
     Console.SetCursorPosition(3, 3);
     Console.WriteLine(timer.milliSeconds / 1000.0);
     
 }
Пример #10
0
 static void Main()
 {
     Timer timer = new Timer(10);
     timer.StartTimer();
 }