Пример #1
0
 public void UnsubscribeToNewTurnEvents(NewTurnEventHandler newObserver)
 {
     if (IsObserverNewTurnInList(newObserver))
     {
         m_newTurnEvents -= new NewTurnEventHandler(newObserver);
     }
 }
Пример #2
0
 private bool IsObserverNewTurnInList(NewTurnEventHandler newObserver)
 {
     if (m_timeEvents != null)
     {
         foreach (var existingHandler in m_timeEvents.GetInvocationList())
         {
             if (Delegate.Equals(existingHandler, newObserver))//existingHandler == newObserver) //If it doesn't work use : if(objA.Method.Name == objB.Method.Name && objA.Target.GetType().FullName == objB.Target.GetType().FullName) OR Delegate.Equals(objA, objB)
             {
                 return(true);
             }
         }
     }
     return(false);
 }