public static void Main(string[] args) { var manager = new MailManager(); var sms = new Sms(manager); var pager = new Pager(manager); manager.SimulateNewMail("Minsk", "Moskva", "Letter"); Thread.Sleep(1000); sms.Unregister(manager); Console.WriteLine(); manager.SimulateNewMail("Moskva", "Minsk", "SMS"); Console.ReadKey(); }
public void Unregister(MailManager mail) { mail.NewMail -= SmsMsg; }
public Sms(MailManager mail) { mail.NewMail += SmsMsg; }
public Pager(MailManager mail) { mail.NewMail += PagerMsg; }