protected internal override void PreparePost(Blog blog, IBlogClient blogClient, OpenLiveWriter.Extensibility.BlogClient.BlogPost blogPost, ref bool? publish)
 {
     BlogPostCategory[] categories = blogClient.GetCategories(blog.BlogId);
     if (categories.Length < 2)
         throw new InvalidOperationException("Blog " + blog.HomepageUrl + " does not have enough categories for the SupportsMultipleCategories test to be performed");
     BlogPostCategory[] newCategories = new BlogPostCategory[2];
     newCategories[0] = categories[0];
     newCategories[1] = categories[1];
     blogPost.Categories = newCategories;
 }
 protected internal override void PreparePost(Blog blog, IBlogClient blogClient, OpenLiveWriter.Extensibility.BlogClient.BlogPost blogPost, ref bool?publish)
 {
     BlogPostCategory[] categories = blogClient.GetCategories(blog.BlogId);
     if (categories.Length < 2)
     {
         throw new InvalidOperationException("Blog " + blog.HomepageUrl + " does not have enough categories for the SupportsMultipleCategories test to be performed");
     }
     BlogPostCategory[] newCategories = new BlogPostCategory[2];
     newCategories[0]    = categories[0];
     newCategories[1]    = categories[1];
     blogPost.Categories = newCategories;
 }
Beispiel #3
0
        private BlogPostCategory[] SafeDownloadCategories()
        {
            try
            {
                IBlogClient blogClient = CreateBlogClient();

                if (blogClient is IBlogClientForCategorySchemeHack && _context is IBlogSettingsDetectionContextForCategorySchemeHack)
                {
                    ((IBlogClientForCategorySchemeHack)blogClient).DefaultCategoryScheme =
                        ((IBlogSettingsDetectionContextForCategorySchemeHack)_context).InitialCategoryScheme;
                }

                return(blogClient.GetCategories(_context.HostBlogId));
            }
            catch (Exception ex)
            {
                ReportException("attempting to download categories", ex);
                return(null);
            }
        }