public async void LoadMoreTweets()
        {
            HomeTlParameters.MaximumNumberOfTweetsToRetrieve = 20;
            HomeTlParameters.MaxId = Tweets.ElementAt(Tweets.IndexOf(Tweets.Last())).Id;

            var newTweets = Tweetinvi.Timeline.GetHomeTimeline(HomeTlParameters);

            if (newTweets != null)
            {
                foreach (var tweet in newTweets)
                {
                    var curTweet = tweet as Tweet;

                    if (curTweet.Id != Tweets.Last().Id)
                    {
                        Tweets.Insert(Tweets.IndexOf(Tweets.Last()) + 1, curTweet);
                    }
                }

                await Task.CompletedTask;
            }
            else
            {
                LoadMoreTweets();
            }
        }
Exemplo n.º 2
0
        public async void LoadMoreTweets()
        {
            var newTweets = Tweetinvi.Timeline.GetUserTimeline(UserToLoad.Id, new UserTimelineParameters {
                MaxId = Tweets.Last().Id,
                MaximumNumberOfTweetsToRetrieve = 20
            });

            if (newTweets != null)
            {
                foreach (var tweet in newTweets)
                {
                    var curTweet = tweet as Tweet;

                    if (curTweet.Id != Tweets.Last().Id)
                    {
                        Tweets.Insert(Tweets.IndexOf(Tweets.Last()) + 1, curTweet);
                    }
                }

                await Task.CompletedTask;
            }
            else
            {
                LoadMoreTweets();
            }
        }
        private void Retweet(object tweetIdStr)
        {
            var tweetId = Convert.ToInt64(tweetIdStr);

            var tweetLocal   = Tweets.Single(i => i.Id == tweetId);
            var tweetBeforRT = Tweetinvi.Tweet.GetTweet(tweetId) as Tweet;

            if (tweetBeforRT.Retweeted)
            {
                Tweetinvi.Tweet.UnRetweet(tweetId);
            }
            else
            {
                Tweetinvi.Tweet.PublishRetweet((long)tweetId);
            }

            var tweetAfterRT = Tweetinvi.Tweet.GetTweet(tweetId) as Tweet;

            Tweets.Insert(Tweets.IndexOf(tweetLocal), tweetAfterRT);
            Tweets.Remove(tweetLocal);
        }
        private void Like(object tweetIdStr)
        {
            var tweetId = Convert.ToInt64(tweetIdStr);

            var tweetLocal = Tweets.Single(i => i.Id == tweetId);

            var tweetBeforLike = Tweetinvi.Tweet.GetTweet(tweetId) as Tweet;

            if (tweetBeforLike.Favorited)
            {
                Tweetinvi.Tweet.UnFavoriteTweet(tweetId);
            }
            else
            {
                Tweetinvi.Tweet.FavoriteTweet((long)tweetId);
            }

            var tweetAfterLike = Tweetinvi.Tweet.GetTweet(tweetId) as Tweet;

            Tweets.Insert(Tweets.IndexOf(tweetLocal), tweetAfterLike);
            Tweets.Remove(tweetLocal);
        }
        private void Reply(object tweetIdStr)
        {
            var tweetId = Convert.ToInt64(tweetIdStr);

            NavigationService.Navigate(typeof(Views.TweetingPage), Tweets.IndexOf(Tweets.Single(i => i.Id == tweetId)));
        }