public void RemoveObserver(IAnnotationRepositoryObserver observer) { if (_observers.Contains(observer)) { _observers.Remove(observer); } }
/// <summary> /// Add the observer to each repository. /// Note that if there are any _others, the same observer will be added to each, /// which currently results in its Initialize method being called with the GetAllAnnotations of each repo. /// Thus, in such cases, the observer's Initialize method must be capable of being called repeatedly /// and accumulating the results. /// </summary> /// <param name="observer"></param> /// <param name="progress"></param> public void AddObserver(IAnnotationRepositoryObserver observer, IProgress progress) { _primary.AddObserver(observer, progress); foreach (var other in _others) { other.AddObserver(observer, progress); } }
/// <summary> /// a typical observer is an index or a user-interface element /// </summary> public void AddObserver(IAnnotationRepositoryObserver observer, IProgress progress) { if (_observers.Exists(i => i.GetType() == observer.GetType())) { //fail fast. throw new ApplicationException("An observer of the type " + observer.GetType().ToString() + " is already in the repository."); } _observers.Add(observer); observer.Initialize(GetAllAnnotations, progress); }
public void AddObserver(IAnnotationRepositoryObserver observer, IProgress progress) { Observer = observer; ProgressPassedToAddObserver = progress; }
public void RemoveObserver(IAnnotationRepositoryObserver observer) { if(_observers.Contains(observer)) _observers.Remove(observer); }
/// <summary> /// a typical observer is an index or a user-interface element /// </summary> public void AddObserver(IAnnotationRepositoryObserver observer, IProgress progress) { if (_observers.Exists(i => i.GetType() == observer.GetType())) { //fail fast. throw new ApplicationException("An observer of the type " + observer.GetType().ToString() + " is already in the repository."); } _observers.Add(observer); observer.Initialize(GetAllAnnotations, progress); }
public void AddObserver(IAnnotationRepositoryObserver observer, IProgress progress) { Observer = observer; ProgressPassedToAddObserver = progress; }
/// <summary> /// Add the observer to each repository. /// Note that if there are any _others, the same observer will be added to each, /// which currently results in its Initialize method being called with the GetAllAnnotations of each repo. /// Thus, in such cases, the observer's Initialize method must be capable of being called repeatedly /// and accumulating the results. /// </summary> /// <param name="observer"></param> /// <param name="progress"></param> public void AddObserver(IAnnotationRepositoryObserver observer, IProgress progress) { _primary.AddObserver(observer, progress); foreach (var other in _others) other.AddObserver(observer, progress); }