Пример #1
0
 static void Main(string[] args)
 {
     Publisher publish = new Publisher();
     Subscriber sub = new Subscriber(publish);
     CustemerEventArgs arg = new CustemerEventArgs(3000);
     publish.DoSomething(arg);
 }
Пример #2
0
 public void DoSomething(CustemerEventArgs e)
 {
     do
     {
         OnRaiseCustomEvent(e);
         System.Threading.Thread.Sleep(e.Seconds);
     } while (true);
 }
Пример #3
0
 protected virtual void OnRaiseCustomEvent(CustemerEventArgs e)
 {
     EventHandler<CustemerEventArgs> handler = RaiseCustomEvent;
     if (handler != null)
     {
         handler(this, e);
     }
 }
Пример #4
0
 void HandleCustomEvent(object sender, CustemerEventArgs e)
 {
     Console.WriteLine("do Something at {0} msec", e.Seconds);
 }