コード例 #1
0
        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();
            }
        }
コード例 #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();
            }
        }
コード例 #3
0
        private async void ExecuteMoreTweetsCommand(Tweet lastTweet)
        {
            if (_isLoadingMore || Tweets.Count == 0 || IsNoMoreTweets)
            {
                return;
            }

            if (lastTweet.Equals(Tweets.Last()))
            {
                _isLoadingMore = true;

                await GetTweets();

                _isLoadingMore = false;
            }
        }