Example #1
0
        static void Main(string[] args)
        {
            Person per1 = new Person("Anton");
            Person per2 = new Person("Roman");
            Person per3 = new Person("Alex");
            Person per4 = new Person("Kate");

            per1.OnCame += PersoneCame;
            per2.OnCame += PersoneCame;
            per3.OnCame += PersoneCame;
            per4.OnCame += PersoneCame;

            per1.OnLeave += PersonLeave;
            per2.OnLeave += PersonLeave;
            per3.OnLeave += PersonLeave;
            per4.OnLeave += PersonLeave;

            per1.ComeToWork();
            Thread.Sleep(300);

            per2.ComeToWork();
            Thread.Sleep(300);

            per3.ComeToWork();
            Thread.Sleep(300);

            per4.ComeToWork();
            Thread.Sleep(300);

            per2.GoHome();
            Thread.Sleep(300);

            per1.GoHome();
            Thread.Sleep(300);

            per3.GoHome();
            Thread.Sleep(300);

            per4.GoHome();
            Thread.Sleep(300);

            Console.ReadKey();
        }