public virtual void ConnectToCityindexStreamingAdapter(string streamingUrl, LsCityindexStreamingConnectionFactory lsCityindexStreamingConnectionFactory)
        {
            if(_cityindexStreamingAdapterIsConnected)
                throw new InvalidOperationException("Can only have one connection open to a lightstreamer cityindex streaming adapter.");

            var cityIndexStreamingAdapterUri = streamingUrl + CITYINDEX_STREAMING_ADAPTER;
            Log.Info("Connecting to lightstreamer uri: " + cityIndexStreamingAdapterUri);
            _lsCityindexStreamingConnection = lsCityindexStreamingConnectionFactory.Create(new Uri(cityIndexStreamingAdapterUri), _apiConnection.UserName, _apiConnection.Session);
            if (_lsCityindexStreamingConnection == null)
                throw new NullReferenceException("Could not create CityindexStreaming adapter connection.");

            _lsCityindexStreamingConnection.StatusChanged += new EventHandler<StatusEventArgs>(LsCityindexStreamingClientConnectionStatusChanged);
            _lsCityindexStreamingConnection.Connect();
            _cityindexStreamingAdapterIsConnected = true;
        }
Exemplo n.º 2
0
        public virtual void ConnectToCityindexStreamingAdapter(string streamingUrl, LsCityindexStreamingConnectionFactory lsCityindexStreamingConnectionFactory)
        {
            if (_cityindexStreamingAdapterIsConnected)
            {
                throw new InvalidOperationException("Can only have one connection open to a lightstreamer cityindex streaming adapter.");
            }

            var cityIndexStreamingAdapterUri = streamingUrl + CITYINDEX_STREAMING_ADAPTER;

            Log.Info("Connecting to lightstreamer uri: " + cityIndexStreamingAdapterUri);
            _lsCityindexStreamingConnection = lsCityindexStreamingConnectionFactory.Create(new Uri(cityIndexStreamingAdapterUri), _apiConnection.UserName, _apiConnection.Session);
            if (_lsCityindexStreamingConnection == null)
            {
                throw new NullReferenceException("Could not create CityindexStreaming adapter connection.");
            }

            _lsCityindexStreamingConnection.StatusChanged += new EventHandler <StatusEventArgs>(LsCityindexStreamingClientConnectionStatusChanged);
            _lsCityindexStreamingConnection.Connect();
            _cityindexStreamingAdapterIsConnected = true;
        }