public void Dispose()
        {
            contentEditor.DocumentComplete -= new EventHandler(blogPostHtmlEditor_DocumentComplete);
            contentEditor.GotFocus -= new EventHandler(contentEditor_GotFocus);
            contentEditor.LostFocus -= new EventHandler(contentEditor_LostFocus);
            contentEditor.Dispose();

            panel.Dispose();
            accountAdapter.Dispose();
            mainFrame.Dispose();

            Marshal.ReleaseComObject(_contentEditorSite);
            _contentEditorSite = null;
            accountAdapter = null;
            contentEditor = null;
            panel = null;
            context = null;
        }
        /// <summary>
        /// Initializes the IContentEditor.
        /// </summary>
        /// <param name="factory"></param>
        /// <param name="contentEditorSite"></param>
        /// <param name="internetSecurityManager"></param>
        /// <param name="wysiwygHTML"></param>
        /// <param name="previewHTML"></param>
        /// <param name="newEditingContext"></param>
        /// <param name="templateStrategy"></param>
        /// <param name="dlControlFlags">
        /// For Mail, these flags should always include DLCTL_DLIMAGES | DLCTL_VIDEOS | DLCTL_BGSOUNDS so that local
        /// images, videos and sounds are loaded. To block external content, it should also include
        /// DLCTL_PRAGMA_NO_CACHE | DLCTL_FORCEOFFLINE | DLCTL_NO_CLIENTPULL so that external images are not loaded
        /// and are displayed as a red X instead.
        /// </param>
        /// <param name="color"></param>
        private void ContentEditorProxyCore(ContentEditorFactory factory, IContentEditorSite contentEditorSite, IInternetSecurityManager internetSecurityManager, string wysiwygHTML, string previewHTML, IBlogPostEditingContext newEditingContext, BlogPostHtmlEditorControl.TemplateStrategy templateStrategy, int dlControlFlags, string color)
        {
            try
            {
                Debug.Assert(contentEditorSite is IUIFramework, "IContentEditorSite must also implement IUIFramework");
                Debug.Assert(contentEditorSite is IDropTarget, "IContentEditorSite must also implement IDropTarget");

                ApplyInstalledCulture();

                this.factory = factory;

                _wysiwygHTML = wysiwygHTML;
                _previewHTML = previewHTML;
                _contentEditorSite = contentEditorSite;

                IntPtr p = _contentEditorSite.GetWindowHandle();
                WINDOWINFO info = new WINDOWINFO();
                User32.GetWindowInfo(p, ref info);
                panel = new Panel();
                panel.Top = 0;
                panel.Left = 0;
                panel.Width = Math.Max(info.rcWindow.Width, 200);
                panel.Height = Math.Max(info.rcWindow.Height, 200);
                panel.CreateControl();
                User32.SetParent(panel.Handle, p);

                accountAdapter = new ContentEditorAccountAdapter();
                mainFrame = new MainFrameWindowAdapter(p, panel, _contentEditorSite, accountAdapter.Id);
                context = newEditingContext;
                contentEditor = new ContentEditor(mainFrame, panel, mainFrame, internetSecurityManager, templateStrategy, dlControlFlags);

                // Prevents asserts
                contentEditor.DisableSpelling();

                contentEditor.OnEditorAccountChanged(accountAdapter);
                contentEditor.DocumentComplete += new EventHandler(blogPostHtmlEditor_DocumentComplete);
                contentEditor.GotFocus += new EventHandler(contentEditor_GotFocus);
                contentEditor.LostFocus += new EventHandler(contentEditor_LostFocus);
                contentEditor.Initialize(context, accountAdapter, wysiwygHTML, previewHTML, false);

                if (!string.IsNullOrEmpty(color))
                {
                    contentEditor.IndentColor = color;
                }
            }
            catch (Exception ex)
            {
                // Something went wrong, make sure we don't reuse a cached editor
                HtmlEditorControl.DisposeCachedEditor();
                Trace.Fail(ex.ToString());
                Trace.Flush();
                throw;
            }
        }
 public void DoPreloadWork()
 {
     ContentEditorProxy.ApplyInstalledCulture();
     SimpleHtmlParser.Create();
     BlogClientHelper.FormatUrl("", "", "", "");
     ContentEditor contentEditor = new ContentEditor(null, new Panel(), null, new BlogPostHtmlEditorControl.BlogPostHtmlEditorSecurityManager(), new ContentEditorProxy.ContentEditorTemplateStrategy(), MshtmlOptions.DEFAULT_DLCTL);
     contentEditor.Dispose();
 }
 public void Apply(ContentEditor editor, uint globalSobitOptions)
 {
     editor.SetSpellingOptions(dllName, lcid, mainLexFiles, userLexFile, sobitOptions | globalSobitOptions, useAutoCorrect);
 }
 public EditorFocusControlProxy(ContentEditor editor)
 {
     _editor = editor;
 }
            public ContentEditorLoadSuppresser(ContentEditor editor)
            {
                _editor = editor;
                _editor.AddLoadSuppressCount();

            }