示例#1
0
 public void add(TickListener listener)
 {
     listeners.Add(listener);
     if (lastTick != null)
     {
         safeProcessTick(listener, lastTick);
     }
 }
示例#2
0
 void safeProcessTick(TickListener listener, JTick t)
 {
     try {
         listener.onTick(t);
     } catch (Exception e) {
         LogC.err(symbol.name + " failed processing " + t, e);
     }
 }
 /// <summary>
 /// Removes a subscriber from the OnTick Event.
 /// </summary>
 /// <param name="listener">The function to be removed from the OnTick Event.</param>
 public static void RemoveTickListener(TickListener listener)
 {
     _onTick -= listener;
 }
 /// <summary>
 /// Add a subscriber to the OnTick Event.
 /// </summary>
 /// <param name="listener">The function to be called when a tick occurs.</param>
 public static void AddTickListener(TickListener listener)
 {
     _onTick += listener;
 }
 /// <summary>
 /// Clear the list of subscribers from OnkeyPressed and OnTick.
 /// </summary>
 public static void Dispose()
 {
     _onKeyPressed = null;
     _onTick       = null;
 }
示例#6
0
 public void subscribe(Symbol symbol, TickListener listener)
 {
     tickListeners.get(symbol).add(listener);
 }