Example #1
0
 public ClassWithEvent(EventManagerClass EventManager)
 {
     if (EventManager != null)
     {
         EventManager.SmthEvent += DoSmth;
     }
 }
Example #2
0
 public virtual void Detach(EventManagerClass EventManager)
 {
     if (EventManager != null)
     {
         EventManager.SmthEvent -= DoSmth;
     }
 }
Example #3
0
        static void Main(string[] args)
        {
            EventManagerClass
                EventManager = new EventManagerClass();

            ClassWithEventI
                c1 = new ClassWithEventI(EventManager);

            ClassWithEventII
                c2 = new ClassWithEventII(EventManager);

            ClassWithEventIII
                c3 = new ClassWithEventIII(null);

            EventManager.Test();

            c3.Attach(EventManager);
            c2.Detach(EventManager);

            EventManager.Test();
        }
Example #4
0
 public ClassWithEventIII(EventManagerClass EventManager) : base(EventManager)
 {
 }