public void UnregisterObserver(IDataObserver concreteObserver) { if (this.DataObservers.Contains(concreteObserver)) { this.DataObservers.Remove(concreteObserver); } }
public void RegisterObserver(IDataObserver concreteObserver, string key) { if (!this.DataObservers.Contains(concreteObserver)) { this.DataObservers.Add(concreteObserver); } }
protected EventReaderBase(string name, IDataObserver <TEventArgs> eventObserver) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException(nameof(name)); } this.name = name; this.events = new List <TEventArgs>(); this.eventObserver = eventObserver; }
public void SubscribeToChannels(IDataObserver observer, params string[] channels) { if (observer != null && channels.Length > 0) { foreach (var channel in channels) { List <IDataObserver> observers = new List <IDataObserver>(); if (subscriptions.TryGetValue(channel, out observers)) { observers.Add(observer); } else { subscriptions[channel] = new List <IDataObserver> { observer }; } } } }
public KeyboardEventSourcer(IDataObserver <KeyboardEventArgs> observer) : base(KeyboardEventSourcer.ReaderName, observer) { }
public MouseEventSourcer(IDataObserver <MouseEventArgs> observer) : base(MouseEventSourcer.ReaderName, observer) { }
public void RemoveObserver(IDataObserver observer) { _observers.Remove(observer); }
public void AddObserver(IDataObserver observer) { _observers.Add(observer); }
public void AddObserver(IDataObserver observer) { if (observers != null) this.observers.Add(observer); }