Esempio n. 1
0
 public void UnregisterObserver(IDataObserver concreteObserver)
 {
     if (this.DataObservers.Contains(concreteObserver))
     {
         this.DataObservers.Remove(concreteObserver);
     }
 }
Esempio n. 2
0
 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;
        }
Esempio n. 4
0
 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
                 };
             }
         }
     }
 }
Esempio n. 5
0
 public KeyboardEventSourcer(IDataObserver <KeyboardEventArgs> observer)
     : base(KeyboardEventSourcer.ReaderName, observer)
 {
 }
 public MouseEventSourcer(IDataObserver <MouseEventArgs> observer)
     : base(MouseEventSourcer.ReaderName, observer)
 {
 }
Esempio n. 7
0
 public void RemoveObserver(IDataObserver observer)
 {
     _observers.Remove(observer);
 }
Esempio n. 8
0
 public void AddObserver(IDataObserver observer)
 {
     _observers.Add(observer);
 }
 public void AddObserver(IDataObserver observer)
 {
     if (observers != null)
         this.observers.Add(observer);
 }