Beispiel #1
0
 private void UnRegisterEvent()
 {
     foreach (Animal mAni in aniArr)
     {
         if (mAni is MachineCat)
         {
             MachineCat mCat = (MachineCat)mAni;
             mCat.RemoveAllEvent();
         }
     }
 }
Beispiel #2
0
 private void RegisterEvent()
 {
     foreach (Animal mAni in aniArr)
     {
         if (mAni is MachineCat)
         {
             MachineCat mCat = (MachineCat)mAni;
             mCat.RemoveAllEvent();
             foreach (Animal ani in aniArr)
             {
                 if ((ani is Cat) && !(ani is MachineCat))
                 {
                     Cat cat = ani as Cat;
                     mCat.change += new MachineCat.ChangeEventHandler(cat.Clap);
                 }
             }
         }
     }
 }