コード例 #1
0
        static void Main(string[] args)
        {
            MailManager mm     = new MailManager();
            Fax         fax1   = new Fax(mm, "Austria");
            Fax         fax2   = new Fax(mm, "London");
            Fax         fax3   = new Fax(mm, "Varshava");
            Pager       pager1 = new Pager(mm, "John");
            Pager       pager2 = new Pager(mm, "Sophia");

            mm.SimulateNewMail("Artur", "Anna", "New Album");
            mm.SimulateNewMail("Gosleng", "Emo", "New Movie!");


            /*
             * PostManager pm = new PostManager();
             * PostService post1 = new PostService(pm);
             * PostService post2 = new PostService(pm);
             *
             * pm.SimulateNewPack("Andrew", "Lesley", "Clocks", "AmazonExpress");
             */

            Console.WriteLine("Enter for exit...");
            Console.ReadLine();
        }
コード例 #2
0
 public Fax(MailManager mm, string faxloc)
 {
     m_faxloc    = faxloc;
     mm.NewMail += FaxMsg; //подписались на событие
 }
コード例 #3
0
 public void Unregister(MailManager mm)
 {
     mm.NewMail -= FaxMsg;
 }
コード例 #4
0
 public Pager(MailManager mm, string owner)
 {
     m_owner     = owner;
     mm.NewMail += PagerMsg;
 }