Ejemplo n.º 1
0
 /// <summary>
 ///     <para>
 ///         Adds the specified symbol to the set of subscribed symbols.
 ///         This is a convenience method to subscribe to one symbol at a time that
 ///         has a return fast-path for a case when the symbol is already in the set.
 ///         When subscribing to multiple symbols at once it is preferable to use
 ///         <see cref="AddSymbols(ICollection{object})"/> method.
 ///         All registered event listeners will receive update on the last events for all
 ///         newly added symbols.
 ///     </para>
 ///     <para>
 ///         Implementation notes.
 ///     </para>
 ///     <para>
 ///         This method notifies all subscribed <see cref="OnSymbolsAdded"/> events on
 ///         symbols changing for this subscription.
 ///     </para>
 /// </summary>
 /// <param name="symbol">The symbol.</param>
 public void AddSymbols(object symbol)
 {
     if (IsClosed)
     {
         return;
     }
     if (symbol == null)
     {
         return;
     }
     lock (symbolsLocker)
     {
         subscriptionInstance.AddSymbol(SymbolToString(symbol));
         OnSymbolsAdded?.Invoke(this, new DXFeedSymbolsUpdateEventArgs(symbol));
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 ///     <para>
 ///         Changes the set of subscribed symbols so that it contains just the symbols from
 ///         the specified array.
 ///         This is a convenience method to set subscription to one or few symbols at a time.
 ///         When setting subscription to multiple symbols at once it is preferable to use
 ///         <see cref="SetSymbols(ICollection{object})"/> method.
 ///         All registered event listeners will receive update on the last events for all
 ///         newly added symbols.
 ///     </para>
 ///     <para>
 ///         Implementation notes.
 ///     </para>
 ///     <para>
 ///         This method notifies all subscribed <see cref="OnSymbolsAdded"/> and
 ///         <see cref="OnSymbolsRemoved"/> events on symbols changing for this subscription.
 ///     </para>
 /// </summary>
 /// <param name="symbols">The array of symbols.</param>
 public void SetSymbols(params object[] symbols)
 {
     if (IsClosed)
     {
         return;
     }
     if (symbols == null || symbols.Length == 0)
     {
         return;
     }
     lock (symbolsLocker)
     {
         OnSymbolsRemoved?.Invoke(this, new DXFeedSymbolsUpdateEventArgs(GetSymbolsUnsafe()));
         subscriptionInstance.SetSymbols(SymbolsToStringList(symbols).ToArray());
         OnSymbolsAdded?.Invoke(this, new DXFeedSymbolsUpdateEventArgs(symbols));
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 ///     <para>
 ///         Adds the specified array of symbols to the set of subscribed symbols.
 ///         This is a convenience method to subscribe to one or few symbols at a time.
 ///         When subscribing to multiple symbols at once it is preferable to use
 ///         <see cref="AddSymbols(ICollection{object})"/> method.
 ///         All registered event listeners will receive update on the last events for all
 ///         newly added symbols.
 ///     </para>
 ///     <para>
 ///         Implementation notes.
 ///     </para>
 ///     <para>
 ///         This method notifies all subscribed <see cref="OnSymbolsAdded"/> events on
 ///         symbols changing for this subscription. The <c>false</c> value of
 ///         <paramref name="callUpdateEvent"/> disables calling any symbols update events
 ///         for this method.
 ///     </para>
 /// </summary>
 /// <param name="callUpdateEvent">
 ///     The <c>false</c> value disables calling any symbols update events for this method.
 /// </param>
 /// <param name="symbols">The array of symbols.</param>
 protected void AddSymbols(bool callUpdateEvent, params object[] symbols)
 {
     if (IsClosed)
     {
         return;
     }
     if (symbols == null || symbols.Length == 0)
     {
         return;
     }
     lock (symbolsLocker)
     {
         subscriptionInstance.AddSymbols(SymbolsToStringList(symbols).ToArray());
         if (callUpdateEvent)
         {
             OnSymbolsAdded?.Invoke(this, new DXFeedSymbolsUpdateEventArgs(symbols));
         }
     }
 }