コード例 #1
0
        public void FetchCurrentBlogAdditionalDataAsync()
        {
            if (null == CurrentBlog)
            {
                throw new ArgumentException("CurrentBlog may not be null", "CurrentBlog");
            }

            GetPostFormatsRPC rpc = new GetPostFormatsRPC(CurrentBlog);

            CurrentBlog.showLoadingIndicator();
            rpc.Completed += OnFetchPostFormatsRPCCompleted;
            rpc.ExecuteAsync();
        }
コード例 #2
0
        public bool FetchCurrentBlogPostsAsync(bool more)
        {
            if (null == CurrentBlog)
            {
                throw new ArgumentException("CurrentBlog may not be null", "CurrentBlog");
            }

            //we're already downloading data here--don't allow scenarios where we could be
            //kicking off another download
            if (_trackedBlogs.Contains(CurrentBlog))
            {
                return(false);
            }

            CurrentBlog.showLoadingIndicator();

            int numerberOfPosts = 0;

            if (more)
            {
                numerberOfPosts = Math.Max(CurrentBlog.PostListItems.Count, CHUNK_SIZE);
                if (CurrentBlog.HasOlderPosts)
                {
                    numerberOfPosts += CHUNK_SIZE;
                }
                else
                {
                    //removing this block you will enable the refresh of posts when reached the end of the list and no more posts are available
                    CurrentBlog.hideLoadingIndicator();
                    return(false);
                }
            }
            else
            {
                numerberOfPosts = CHUNK_SIZE;
            }

            GetRecentPostsRPC rpc = new GetRecentPostsRPC(CurrentBlog);

            rpc.NumberOfPosts = numerberOfPosts;
            rpc.Completed    += OnFetchCurrentBlogPostsCompleted;

            CurrentBlog.IsLoadingPosts = true;

            rpc.ExecuteAsync();
            return(true);
        }