protected override void DoWork() { using (BlogClientUIContextScope uiScope = new BlogClientUIContextScope(_uiContext)) { using (Blog blog = new Blog(_blogId)) { // Fix bug 457160 - New post created with a new category // becomes without a category when opened in WLW // // See also PostEditorPostSource.GetPost(string) try { blog.RefreshCategories(); } catch (Exception e) { Trace.Fail("Exception while attempting to refresh categories: " + e.ToString()); } _serverBlogPost = blog.GetPost(_blogPost.Id, _blogPost.IsPage); if (_serverBlogPost == null) _noPostAvailable = true; } } }
public IBlogPostEditingContext GetPost(string postId) { foreach (BlogPost blogPost in _blogPosts) { using (Blog blog = new Blog(_blogId)) { if (blogPost.Id == postId) { // Fix bug 457160 - New post created with a new category // becomes without a category when opened in WLW // // See also RecentPostSynchronizer.DoWork() // // Necessary even in the case of inline categories, // since the inline categories may contain categories // that Writer is not yet aware of try { blog.RefreshCategories(); } catch (Exception e) { Trace.Fail("Exception while attempting to refresh categories: " + e.ToString()); } // Get the full blog post--necessary because Atom ETag and remote post data is // only available from the full call BlogPost blogPostWithCategories = blog.GetPost(postId, blogPost.IsPage); return new BlogPostEditingContext( _blogId, blogPostWithCategories); } } } // if we get this far then it was a bad postId throw new ArgumentException("PostId was not part of the headers fetched"); }