Example #1
0
        /// <summary>
        /// Gets the blog posts on a specified page
        /// </summary>
        /// <param name="i">The 0-based index of the page whose blog posts are queried.</param>
        /// <returns>The blog posts on the specified page.</returns>
        public async Task <BlogPostEntity[]> GetBlogPostsOnPageAsync(int i)
        {
            if (HasNotInitialized)
            {
                await InitAsync();
            }

            if (BlogPosts[i] == null)
            {
                BlogPosts[i] = (await _client.GetQueryBlogPostsResponseAsync(
                                    selectColumns: new List <string>()
                {
                    "PartitionKey",
                    "RowKey",
                    "Timestamp",
                    "Author",
                    "Text"
                },
                                    takeCount: numOfBlogPostsOnPage,
                                    nextKeys: (PartitionKeys[i * numOfBlogPostsOnPage], RowKeys[i * numOfBlogPostsOnPage])
                                    )).BlogPosts.ToArray();

                await _localStorage.SetItemAsync(blogPostsKey, BlogPosts);
            }
            return(BlogPosts[i]);
        }