Bloom.Edit.WebThumbNailList.UpdateThumbnailAsync C# (CSharp) Method

UpdateThumbnailAsync() public method

public UpdateThumbnailAsync ( IPage page ) : void
page IPage
return void
        public void UpdateThumbnailAsync(IPage page)
        {
            if (page.Book.Storage.NormalBaseForRelativepaths != _baseForRelativePaths)
            {
                // book has been renamed! can't go on with old document that pretends to be in the wrong place.
                // Regenerate completely.
                UpdateItems(_pages);
                return;
            }
            var targetClass = "bloom-page";
            var gridElt = GetGridElementForPage(page);
            var pageContainerElt = GetFirstChildWithClass(gridElt, PageContainerClass) as GeckoElement;
            if (pageContainerElt == null)
            {
                Debug.Fail("Can't update page...missing pageContainer element");
                return; // for end user we just won't update the thumbnail.
            }
            var pageElt = GetFirstChildWithClass(pageContainerElt, targetClass);
            if (pageElt == null)
            {
                Debug.Fail("Can't update page...missing page element");
                return; // for end user we just won't update the thumbnail.
            }
            // Remove listeners so that garbage collection resulting from the Dispose has a better
            // chance to work (without entanglements between javascript and mozilla's DOM memory).
            RemoveThumbnailListeners();
            var divNodeForThisPage = page.GetDivNodeForThisPage();
            //clone so we can modify it for thumbnailing without messing up the version we will save
            divNodeForThisPage = divNodeForThisPage.CloneNode(true) as XmlElement;
            MarkImageNodesForThumbnail(divNodeForThisPage);
            var geckoNode = MakeGeckoNodeFromXmlNode(_browser.WebBrowser.Document, divNodeForThisPage);
            pageContainerElt.ReplaceChild(geckoNode, pageElt);
            pageElt.Dispose();
            AddThumbnailListeners();
        }