コード例 #1
0
        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();
        }
コード例 #2
0
 public void Message(Publisher publisher, EventArgs e)
 {
     Console.WriteLine(publisher.CurrentRepetition);
 }
コード例 #3
0
 public void Subscribe(Publisher publisher)
 {
     publisher.RaiseCustomEvent += new Publisher.TimerDelegate(Message);
 }