private async Task Run()
        {
            var keywords = SearchGroups.Contains("|") ? string.Join(",", SearchGroups.Split('|')) : SearchGroups;
            var config   = new EventHubConfig();

            config.ConnectionString = EventHubConnectionString;
            config.EventHubName     = EventHubName;

            Tweet             = new Tweet();
            Tweet.keepRunning = true;
            var myEventHubObserver = new EventHubObserverWPF(config);

            var sendingPayload = Tweet.StreamStatuses(new TwitterConfig(OAuthToken, OAuthTokenSecret, OAuthCustomerKey, OAuthConsumerSecret,
                                                                        keywords, SearchGroups)).Select(tweet => Sentiment.ComputeScore(tweet, SearchGroups, RequireAll ? "all" : "any")).Select(tweet => new Payload {
                CreatedAt = tweet.CreatedAt, Topic = tweet.Topic, SentimentScore = tweet.SentimentScore, Author = tweet.UserName, Text = tweet.Text, SendExtended = SendExtendedInformation
            });

            if (ClearUnfoundSentiment)
            {
                sendingPayload = sendingPayload.Where(e => e.SentimentScore > -1);
            }
            sendingPayload = sendingPayload.Where(e => e.Topic != "No Match");
            SendingPayload = await Task <IDisposable> .Run(() =>
            {
                return(SendingPayload = sendingPayload.ToObservable().Subscribe(myEventHubObserver));
            });
        }
        static void Main(string[] args)
        {
            //Configure Twitter OAuth
            var oauthToken          = ConfigurationManager.AppSettings["oauth_token"];
            var oauthTokenSecret    = ConfigurationManager.AppSettings["oauth_token_secret"];
            var oauthCustomerKey    = ConfigurationManager.AppSettings["oauth_consumer_key"];
            var oauthConsumerSecret = ConfigurationManager.AppSettings["oauth_consumer_secret"];
            var keywords            = ConfigurationManager.AppSettings["twitter_keywords"];

            //Configure EventHub
            var config = new EventHubConfig();

            config.ConnectionString = ConfigurationManager.AppSettings["EventHubConnectionString"];
            config.EventHubName     = ConfigurationManager.AppSettings["EventHubName"];
            var myEventHubDataSender = new EventHubDataSender(config);

            var tweeterData = Tweet.StreamStatuses(new TwitterConfig(oauthToken, oauthTokenSecret, oauthCustomerKey, oauthConsumerSecret,
                                                                     keywords)).Select(tweet => Sentiment.ComputeScore(tweet, keywords)).Select(tweet => new Payload {
                CreatedAt = tweet.CreatedAt, Text = tweet.Text, Topic = tweet.Topic, SentimentScore = tweet.SentimentScore
            });

            tweeterData.ToObservable().Subscribe(myEventHubDataSender);
        }
        public void AnalyzeData(string UserId)
        {
            if (!string.IsNullOrWhiteSpace(UserId))
            {
                userId = UserId;
                try
                {
                    //Configure Twitter OAuth
                    var oauthToken          = ConfigurationManager.AppSettings["oauth_token"];
                    var oauthTokenSecret    = ConfigurationManager.AppSettings["oauth_token_secret"];
                    var oauthCustomerKey    = ConfigurationManager.AppSettings["oauth_consumer_key"];
                    var oauthConsumerSecret = ConfigurationManager.AppSettings["oauth_consumer_secret"];

                    //Configure EventHub
                    var config = new EventHubConfig();
                    config.ConnectionString = ConfigurationManager.AppSettings["EventHubConnectionString"];
                    config.EventHubName     = ConfigurationManager.AppSettings["EventHubName"];
                    var myEventHubObserver = new EventHubObserver(config);


                    var datum = Tweet.StreamStatuses(new TwitterConfig(oauthToken, oauthTokenSecret, oauthCustomerKey, oauthConsumerSecret,
                                                                       keywords)).Select(tweet => Sentiment.ComputeScore(tweet, keywords)).
                                Where(tweet => tweet.Topic != "Unknown" &&
                                      (tweetTimeZone.ToUpper().Contains(tweet.TimeZone.ToUpper()) || string.Compare(tweetTimeZone, "All") == 0) &&
                                      DateTime.Compare(DateTime.Now, tweetEndTime) <= 0).
                                Select(tweet => new Payload
                    {
                        CreatedAt      = tweet.CreatedAt,
                        UserId         = UserId,
                        Topic          = tweet.Topic,
                        SentimentScore = tweet.SentimentScore,
                        PlaceTimeZone  = tweet.TimeZone,
                        TweetText      = tweet.Text,
                        Retweeted      = tweet.Retweeted,
                        RetweetCount   = tweet.RetweetCount
                    });

                    datum.ToObservable().Subscribe(myEventHubObserver);
                }
                catch (Exception ex)
                {
                    logger.Log(ex.StackTrace, LOGLEVELS.ERROR);
                }
            }
        }