static void Main(string[] args) { Publisher pub = new Publisher(100, 20); Subscriber sub = new Subscriber(); sub.Subscribe(pub); Console.WriteLine("This event will repeat 20 times"); pub.Start(); pub.Reset(); Console.WriteLine("This event will repeat 20 times"); pub.Start(); }
public void Message(Publisher publisher, EventArgs e) { Console.WriteLine(publisher.CurrentRepetition); }
public void Subscribe(Publisher publisher) { publisher.RaiseCustomEvent += new Publisher.TimerDelegate(Message); }