Exemple #1
0
        static void Main(string[] args)
        {
            Person        jason   = new Person("Jason");
            Person        jim     = new Person("Jim");
            Person        dima    = new Person("Dima");
            Person        ivan    = new Person("Ivan");
            List <Person> persons = new List <Person>()
            {
                jason,
                jim,
                dima,
                ivan
            };
            Office office = new Office(persons);

            jason.GoToWork();
            jim.GoToWork();
            dima.GoToWork();
            ivan.GoToWork();
            jason.GoHome();
            jim.GoHome();
            dima.GoHome();
            ivan.GoHome();
            jason.GoHome();
        }
Exemple #2
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();
        }