Exemplo n.º 1
0
        public static async Task <Blog> FromUserAsync(UserProfile user)
        {
            if (string.IsNullOrWhiteSpace(user.BlogName) ||
                string.IsNullOrWhiteSpace(user.DropboxAccessToken))
            {
                return(null);
            }

            using (var client = new DropboxClient(user.DropboxAccessToken, userAgent: "SimpleBlogDemo"))
            {
                return(new Blog
                {
                    BlogName = user.BlogName,
                    BlogArticles = new List <ArticleMetadata>(await client.GetArticleList()).AsReadOnly()
                });
            }
        }