コード例 #1
0
 public ClassWithEvent(EventManagerClass EventManager)
 {
     if (EventManager != null)
     {
         EventManager.SmthEvent += DoSmth;
     }
 }
コード例 #2
0
 public virtual void Detach(EventManagerClass EventManager)
 {
     if (EventManager != null)
     {
         EventManager.SmthEvent -= DoSmth;
     }
 }
コード例 #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();
        }
コード例 #4
0
 public ClassWithEventIII(EventManagerClass EventManager) : base(EventManager)
 {
 }