예제 #1
0
 public void Attach(ICharacterObserver observer)
 {
     if (observer == null)
     {
         throw new ArgumentNullException();
     }
     if (ObserversList.Contains(observer))
     {
         throw new InvalidOperationException("Cannot have duplicate observers.");
     }
     ObserversList.Add(observer);
 }
예제 #2
0
 public void Detach(ICharacterObserver observer)
 {
     if (observer == null)
     {
         throw new ArgumentNullException();
     }
     if (!ObserversList.Contains(observer))
     {
         throw new InvalidOperationException("Cannot remove observer when observer not in the list.");
     }
     if (ObserversList.Count == 0)
     {
         throw new InvalidOperationException("The observer list is empty. Cannot detach.");
     }
     ObserversList.Remove(observer);
 }
 /// <summary>
 /// Unsubscribe to remove notifications of the Characterchanged events
 /// </summary>
 /// <param name="iCO"></param>
 public void UnSubscribe(ICharacterObserver iCO)
 {
     charHandler -= new CharacterHandler <CharacterSheet>(iCO.CharacterChangedEvent);
 }
 public void Detach(ICharacterObserver observer)
 {
     if (observer == null)
         throw new ArgumentNullException();
     if (!ObserversList.Contains(observer))
         throw new InvalidOperationException("Cannot remove observer when observer not in the list.");
     if (ObserversList.Count == 0)
         throw new InvalidOperationException("The observer list is empty. Cannot detach.");
     ObserversList.Remove(observer);
 }
 public void Attach(ICharacterObserver observer)
 {
     if (observer == null)
         throw new ArgumentNullException();
     if (ObserversList.Contains(observer))
         throw new InvalidOperationException("Cannot have duplicate observers.");
     ObserversList.Add(observer);
 }
예제 #6
0
 public void Subscribe(ICharacterObserver observer)
 {
     observers.Add(observer);
 }