Beispiel #1
0
        /// <summary>
        /// Scans the DOM for images that have not yet been properly initialized by the editor.
        /// As part of the initialization, the default image settings and effects will be applied to the image.
        /// </summary>
        internal static void ScanAndInitializeNewImages(IBlogPostHtmlEditor currentEditor, ISupportingFileService fileService, IEditorAccount editorAccount, ContentEditor editor, Control owner, bool useDefaultTargetSettings, bool selectLastImage)
        {
            if (currentEditor is BlogPostHtmlEditorControl)
            {
                // Scanning the images and doing basic initialization is done on the UI thread.
                List <NewImageInfo> newImages = ScanImages(currentEditor, editorAccount, editor, useDefaultTargetSettings);

                if (newImages.Count > 0)
                {
                    // The time-consuming initialization is done in a background thread.
                    ImageInitializationAsyncOperation imageInitializer = new ImageInitializationAsyncOperation(newImages, fileService, owner);
                    imageInitializer.Completed += new EventHandler((sender, e) =>
                                                                   ProcessInitializedImages(newImages, currentEditor, editor, owner, selectLastImage));

                    editor.DisposeOnEditorChange(imageInitializer);

                    imageInitializer.Start();
                }
            }
        }
        /// <summary>
        /// Scans the DOM for images that have not yet been properly initialized by the editor.
        /// As part of the initialization, the default image settings and effects will be applied to the image.
        /// </summary>
        internal static void ScanAndInitializeNewImages(IBlogPostHtmlEditor currentEditor, ISupportingFileService fileService, IEditorAccount editorAccount, ContentEditor editor, Control owner, bool useDefaultTargetSettings, bool selectLastImage)
        {
            if (currentEditor is BlogPostHtmlEditorControl)
            {
                // Scanning the images and doing basic initialization is done on the UI thread.
                List<NewImageInfo> newImages = ScanImages(currentEditor, editorAccount, editor, useDefaultTargetSettings);

                if (newImages.Count > 0)
                {
                    // The time-consuming initialization is done in a background thread.
                    ImageInitializationAsyncOperation imageInitializer = new ImageInitializationAsyncOperation(newImages, fileService, owner);
                    imageInitializer.Completed += new EventHandler((sender, e) =>
                        ProcessInitializedImages(newImages, currentEditor, editor, owner, selectLastImage));

                    editor.DisposeOnEditorChange(imageInitializer);

                    imageInitializer.Start();
                }
            }
        }