Esempio n. 1
0
        public void QueueSubscribeData(string Symbol, string Params, List <string> Channels = null,
                                       bool IsSubscribe = true, bool CreateRec = false)
        {
            lock ( SymbolsQueue )
            {
                var QueuedSymbol = new QueuedSymbolRec()
                {
                    Symbol    = Symbol, Params = Params, Channels = Channels,
                    CreateRec = CreateRec, IsSubscribe = true, IsQueued = true
                };

                SymbolsQueue.Add(QueuedSymbol);

                FireOnTextInfoEvent($"{Symbol} was queued for subscribe on socket connected");
                OnSymbolQueuedEvent?.Invoke(QueuedSymbol);
            }
        }
Esempio n. 2
0
        private void OnWebSocketOpened(string ClusterName)
        {
            lock ( SymbolsQueue )
            {
                // handoff to Dispatcher at normal priority
                // to allow for UI thread access
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    foreach (var QueuedSymbol in SymbolsQueue)
                    {
                        QueuedSubscribe(QueuedSymbol);

                        QueuedSymbol.IsQueued = false;
                        OnSymbolQueuedEvent?.Invoke(QueuedSymbol);
                    }
                }));

                SymbolsQueue.Clear();
            }
        }