Beispiel #1
0
        public ObservableCollection <TwitterTrend> CollectTrend(IPlaceTrends trends)
        {
            TrendCollection collection = new TrendCollection();

            foreach (var tr in trends.Trends.ToList())
            {
                TwitterTrend t = new TwitterTrend
                {
                    Name            = tr.Name,
                    URL             = tr.URL,
                    Query           = tr.Query,
                    PromotedContent = tr.PromotedContent,
                    TweetVolume     = tr.TweetVolume,
                };
                collection.Add(t);
            }
            return(collection);
        }
Beispiel #2
0
        public tweetyzard()
        {
            InitializeComponent();
            searchPhraseTextBox.Focus();

            try
            {
                TwitterCredentials.Credentials = TwitterCredentials.CreateCredentials(accessToken, accessTokenSecret, consumerKey, consumerSecret);
            }
            catch
            {
                MessageBox.Show("Exception occured at authentication");
                return;
            }

            var loggedUser = User.GetLoggedUser();

            if (loggedUser != null)
            {
                userNameLabel.Visible = true;
                pbUser.Visible        = true;
                userNameLabel.Text    = loggedUser.Name;
            }
            else
            {
                userNameLabel.Visible = false;
                pbUser.Visible        = false;
            }

            lblStream.ForeColor = Color.DimGray;
            btnExport.Enabled   = false;
            ExportToDb.Enabled  = false;

            string version = "ver." + System.Reflection.Assembly.GetExecutingAssembly()
                             .GetName()
                             .Version
                             .ToString();

            versionInfo.Text = version;

            try
            {
                trendingTopics.Text = "";
                var          trendsController = TweetinviContainer.Resolve <ITrendsController>();
                IPlaceTrends placeTrends      = trendsController.GetPlaceTrendsAt(1);

                if (placeTrends != null)
                {
                    trends = placeTrends.Trends;
                }
            }
            catch
            {
                trendingTopics.Text = "";
            }

            toolTipTw.SetToolTip(this.btnStartStream, "Starts the stream of tweets for the given keyword using Stream API");
            toolTipTw.SetToolTip(this.btnSearch, "Searches tweets for the given keyword using Search API");
            toolTipTw.SetToolTip(this.btnExport, "Exports gathered tweets to choosen datasource");
            toolTipTw.SetToolTip(this.btnReset, "Refreshes the form");
            toolTipTw.SetToolTip(this.btnStopStream, "Stops the running search query");
            toolTipTw.SetToolTip(this.geoFlag, "Searches tweets which are only geo tagged");
        }