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