Example #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter event period in ms");
            int.TryParse(Console.ReadLine(), out int period);
            NewsResourse nr      = new NewsResourse();
            Client       client1 = new Client();
            Client       client2 = new Client();

            nr.MakeMessage += client1.ReactToMessage;

            TimerCallback timerCB = new TimerCallback(StaticMethodToCallEvent);
            Timer         timer   = new Timer(StaticMethodToCallEvent, nr, 0, period);

            Console.ReadKey();
        }
Example #2
0
        static void StaticMethodToCallEvent(Object state)
        {
            NewsResourse nr = (NewsResourse)state;

            nr.SendMessage();
        }