Beispiel #1
0
        public ContentEditorProxy(ContentEditorFactory factory, IContentEditorSite contentEditorSite, IInternetSecurityManager internetSecurityManager, IHTMLDocument2 htmlDocument, HtmlInsertOptions options, int dlControlFlags, string color, string wpost)
        {
            string content = htmlDocument.body.innerHTML;

            htmlDocument.body.innerHTML = "{post-body}";
            string   wysiwygHTML                   = HTMLDocumentHelper.HTMLDocToString(htmlDocument);
            BlogPost documentToBeLoaded            = null;
            IBlogPostEditingContext editingContext = null;

            if (string.IsNullOrEmpty(wpost) || !File.Exists(wpost))
            {
                documentToBeLoaded = new BlogPost();
                editingContext     = new BlogPostEditingContext(ContentEditorAccountAdapter.AccountId,
                                                                documentToBeLoaded);
            }
            else
            {
                PostEditorFile wpostxFile = PostEditorFile.GetExisting(new FileInfo(wpost));
                editingContext = wpostxFile.Load(false);
                editingContext.BlogPost.Contents = "";
            }

            if (!string.IsNullOrEmpty(content))
            {
                delayedInsertOperations.Enqueue(new DelayedInsert(content, options));
            }

            ContentEditorProxyCore(factory, contentEditorSite, internetSecurityManager, wysiwygHTML, null, editingContext, new ContentEditorTemplateStrategy(), dlControlFlags, color);
        }
        private static void ExecutePostEditorFile(string filename, IDisposable splashScreen)
        {
            if (VerifyPostEditorFileIsEditable(filename))
            {
                // load the contents of the file
                PostEditorFile          postEditorFile = PostEditorFile.GetExisting(new FileInfo(filename));
                IBlogPostEditingContext editingContext = postEditorFile.Load();

                // launch the editing form (request post synchronization)
                PostEditorForm.Launch(editingContext, true, splashScreen);
            }
            else
            {
                if (splashScreen != null)
                {
                    splashScreen.Dispose();
                }
            }
        }
Beispiel #3
0
 public static bool SafeDeleteLocalPost(FileInfo postFile)
 {
     try
     {
         PostEditorFile postEditorFile = PostEditorFile.GetExisting(postFile);
         if (postEditorFile != null)
         {
             postEditorFile.Delete();
         }
         return(true);
     }
     catch (Exception ex)
     {
         DisplayableException displayableException = new DisplayableException(
             StringId.ErrorOccurredDeletingDraft, StringId.ErrorOccurredDeletingDraftDetails, ex.Message);
         DisplayableExceptionDisplayForm.Show(Win32WindowImpl.ForegroundWin32Window, displayableException);
         return(false);
     }
 }
        public IBlogPostEditingContext GetPost(string postId)
        {
            PostEditorFile postEditorFile = PostEditorFile.GetExisting(new FileInfo(postId));

            return(postEditorFile.Load());
        }
Beispiel #5
0
 public ContentEditorProxy(ContentEditorFactory factory, IContentEditorSite contentEditorSite, IInternetSecurityManager internetSecurityManager, string wysiwygHTML, string previewHTML, string pathToFile, int dlControlFlags)
 {
     ContentEditorProxyCore(factory, contentEditorSite, internetSecurityManager, wysiwygHTML, previewHTML, PostEditorFile.GetExisting(new FileInfo(pathToFile)).Load(false), new ContentEditorTemplateStrategy(), dlControlFlags, null);
 }