protected override HttpWebRequest CreateWebRequest(StreamingAPIParameters p)
        {
            string url = ConstructUrlWithQueryString(StreamRequestUrl, p);
            var request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = "GET";

            var header = CreateAuthHeader(request);
            request.Headers.Add("Authorization", header.GetHeaderString());

            return request;
        }
        protected static string ConstructUrlWithQueryString(string url, StreamingAPIParameters p)
        {
            // This technique create a specialized version of NameValueCollection.
            // Calling its ToString() method yields a correctly encoded querystring.
            var nv = HttpUtility.ParseQueryString(string.Empty);

            if (p != null)
            {
                if (p.Count != 0)
                    nv.Add("count", p.Count.ToString());
                if (p.Delimited != 0)
                    nv.Add("delimited", p.Delimited.ToString());
            }

            return url + (nv.Count == 0 ? string.Empty : "?" + nv.ToString());
        }
        private void StartStreamingTweetsFor(string search)
        {
            _tweetEventSource.Stop();

            StreamingAPIParameters streamingApiParameters = null;
            if (!string.IsNullOrWhiteSpace(search))
            {
                streamingApiParameters = new StreamingAPIParameters {Track = search.Split(',')};
            }
            _tweetEventSource.Start(streamingApiParameters);
            while (IsActiveAndHasTweetEvents)
            {
                _tweetEventSource.Dispatch(5000);
            }
        }