예제 #1
0
 /// <summary>
 /// Check that instrument profiles update is not empty and call listener.
 /// </summary>
 /// <param name="listener">Listener to call.</param>
 /// <param name="instrumentProfiles">Instrument profiles updates.</param>
 private static void CheckAndCallListener(InstrumentProfileUpdateListener listener,
                                          ICollection <InstrumentProfile> instrumentProfiles)
 {
     if (instrumentProfiles == null || instrumentProfiles.Count == 0)
     {
         return;
     }
     listener.InstrumentProfilesUpdated(instrumentProfiles);
 }
예제 #2
0
 /// <summary>
 /// Removes listener that is notified about any updates in the set of instrument profiles.
 /// </summary>
 /// <param name="listener">Profile update listener.</param>
 /// <exception cref="ArgumentNullException">If listener is null.</exception>
 public void RemoveUpdateListener(InstrumentProfileUpdateListener listener)
 {
     if (listener == null)
     {
         throw new ArgumentNullException(nameof(listener));
     }
     lock (listenersLocker)
     {
         listeners.Remove(listener);
     }
 }
예제 #3
0
 /// <summary>
 /// Adds listener that is notified about any updates in the set of instrument profiles.
 /// If a set of instrument profiles is not empty, then this listener is immediately
 /// notified right from inside this add method.
 /// </summary>
 /// <param name="listener">Profile update listener.</param>
 /// <exception cref="ArgumentNullException">If listener is null.</exception>
 public void AddUpdateListener(InstrumentProfileUpdateListener listener)
 {
     if (listener == null)
     {
         throw new ArgumentNullException(nameof(listener));
     }
     lock (listenersLocker)
     {
         if (!listeners.Contains(listener))
         {
             listeners.Add(listener);
         }
         CheckAndCallListener(listener, updater.InstrumentProfiles);
     }
 }