示例#1
0
 private void BuildListener_CITYINDEXSTREAMINGDEFAULTPRICES_DataAdapterSet()
 {
     LogToScreen("building listener on CITYINDEXSTREAMINGDEFAULTPRICES data adapter");
     _defaultPriceListener = StreamingClient.BuildDefaultPricesListener(ACCOUNTOPERATORID);
     _defaultPriceListener.MessageReceived += _defaultPricesListener_MessageReceived;
     LogToScreen("listener on CITYINDEXSTREAMING built");
 }
示例#2
0
        private void StartButtonClick(object sender, RoutedEventArgs e)
        {
            Dispatcher.BeginInvoke(() => { listBox2.Items.Add("Starting"); });

            Dispatcher.BeginInvoke(() =>
            {
                listBox1.Items.Clear();
                listBox2.Items.Clear();
                listBox3.Items.Clear();

                StartButton.IsEnabled = false;
                StopButton.IsEnabled  = false;


                _backgroundRpcStop = false;
                _backgroundRpc     = new Thread(() =>
                {
                    while (_backgroundRpcStop == false)
                    {
                        new AutoResetEvent(false).WaitOne(100000);
                        var marketInfo = rpcClient.Market.GetMarketInformation("400535967");
                        Dispatcher.BeginInvoke(() => listBox3.Items.Add(marketInfo.MarketInformation.MarketId));
                    }
                    return;
                });
                _backgroundRpc.Start();
                new Thread(() =>
                {
                    Debug.WriteLine("building listener2");
                    _listener = _streamingClient.BuildPricesListener(400535967, 81136, 400509294, 400535971, 80902, 400509295, 400193864, 400525367, 80926, 400498641, 400193866, 91047, 400194551, 121766, 400172033, 139144);
                    _listener.MessageReceived += ListenerMessageReceived;
                    Debug.WriteLine("building listener");

                    _listener2 = _streamingClient.BuildDefaultPricesListener(2347);
                    _listener2.MessageReceived += Listener2MessageReceived;
                    Debug.WriteLine("listener started");
                    Debug.WriteLine("listener2 started");

                    Dispatcher.BeginInvoke(() =>
                    {
                        StartButton.IsEnabled = false;
                        StopButton.IsEnabled  = true;
                    });
                }).Start();
            });
        }