public static void Main()
        {
            Timer timer = new Timer(300, 8);
            timer.TDelegate += PrintMethod;

            Console.WriteLine("Start Test");
            timer.Execute();
            Console.WriteLine("Finish Test");
        }
Example #2
0
        static void Main(string[] args)
        {
            TimerDelagate timerDelagate = DoSomething;

            Timer testTimer = new Timer(5, 5, timerDelagate);
            testTimer.Play(DoSomething);
        }
Example #3
0
    private Timer.Timer CreateTimerService(IOptions <TimerOptions> config,
                                           IBackgroundTaskQueue <MotorCloudEvent <IJobExecutionContext> > queue)
    {
        var timer = new Timer.Timer(config, queue, GetApplicationNameService());

        return(timer);
    }
        static void Main(string[] args)
        {
            Timer timer = new Timer(10);
            timer.Methods = TestMethod1;
            timer.Methods += TestMethod2;

            timer.Execute();
        }
        static void Main()
        {
            Timer timer = new Timer(4, 1000);

            timer.Elapsed += timer_Elapsed;

            timer.Start();
        }
Example #6
0
        static void Main(string[] args)
        {
            Timer timer = new Timer(2);
            timer.AllMethods += SaySomething;
            timer.AllMethods += ILoveYou;

            timer.ExecuteMethods();
        }
        static void Main()
        {
            Action action = () => Console.WriteLine(DateTime.Now);

            Timer timer = new Timer(5, 1000, action);

            timer.Start();
        }
Example #8
0
 static void Main()
 {
     Timer newTime = new Timer();
     int t = 5;
     Action a = newTime.PrintTime;       //use of predefined delegate Action with return type void and no arguments
     a += newTime.Restart;               //attach a method to the delegate
     Console.WriteLine("You have to press Ctrl + C to stop the program.");
     newTime.Run(a, t);
 }
Example #9
0
        static void Main()
        {
            Timer timer = new Timer(5);

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

            timer.ExecuteMethods();
        }
        static void Main(string[] args)
        {
            var timer = new Timer.Timer(10000);

            var client1 = new Client1(timer);
            var client2 = new Client2(timer);

            timer.StartTimer();
            Console.ReadKey();
        }
        static void Main()
        {
            Timer timer = new Timer(TimeNow);
            int t = new int();
            t = 7000; //miliseconds

            while (true)
            {
                timer(DateTime.Now);
                System.Threading.Thread.Sleep(t);
            }
        }
Example #12
0
        static void Main(string[] args)
        {
            Timer.Timer timer = new Timer.Timer();

            Subscriber1 subscriber1 = new Subscriber1();

            subscriber1.StartMail(timer);

            Subscriber2 subscriber2 = new Subscriber2();

            subscriber2.StartMail(timer);

            timer.StartTimer(5000);

            Console.ReadLine();
        }
Example #13
0
    void Start()
    {
        /*
         * this.state = new State.ChainedState(new State.State[] {
         *  new State.TimedState("A", 120),
         *  new State.TimedState("B", 200),
         *  new State.TimedState("C", 100).Resets()
         * });
         */

        this.state = new State.ChainedState(new State.State[]
        {
            new State.TimedState("A", 60),
            new State.TimedState("B", 200),
        }).Loops();

        this.timer = new Timer.Timer();
    }
Example #14
0
 static void Main(string[] args)
 {
     try
     {
         Console.Write("Введите время задержки таймера в секундах:");
         int delay = 0;
         if (!Int32.TryParse(Console.ReadLine(), out delay) || delay < 0)
         {
             throw new InvalidCastException("Bad delay");
         }
         Timer.Timer  t  = new Timer.Timer(delay * 1000);
         FirstClient  fc = new FirstClient();
         SecondClient sc = new SecondClient();
         t.TimeEnd += fc.PrintMessage;
         t.TimeEnd += sc.PrintMessage;
         t.StartTimer();
         Console.ReadLine();
     }
     catch (InvalidCastException e)
     {
         Console.WriteLine(e.Message);
         Console.ReadLine();
     }
 }
        static void Main(string[] args)
        {
            try
            {
                Console.Write("Введите время задержки таймера в секундах:");
                int delay = 0;
                if (!Int32.TryParse(Console.ReadLine(), out delay) || delay < 0)
                    throw new InvalidCastException("Bad delay");
                Timer.Timer t = new Timer.Timer(delay * 1000);
                FirstClient fc = new FirstClient();
                SecondClient sc = new SecondClient();
                t.TimeEnd += fc.PrintMessage;
                t.TimeEnd += sc.PrintMessage;
                t.StartTimer();
                Console.ReadLine();
            }
            catch (InvalidCastException e)
            {
                Console.WriteLine(e.Message);
                Console.ReadLine();
            }
            

        }
        public static void Main()
        {
            var timer = new Timer(seconds: 1, method: Print);

            timer.Start(seconds: 5);
        }
Example #17
0
 static void Main()
 {
     Timer t = new Timer(1);
     t.Method += Test;
     t.Start("Hi there!");
 }
        static void Main(string[] args)
        {
            Timer timer=new Timer(1);

            timer.BeginInvoke();
        }