本文整理汇总了C#中IPage.GetDivNodeForThisPage方法的典型用法代码示例。如果您正苦于以下问题:C# IPage.GetDivNodeForThisPage方法的具体用法?C# IPage.GetDivNodeForThisPage怎么用?C# IPage.GetDivNodeForThisPage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPage
的用法示例。
在下文中一共展示了IPage.GetDivNodeForThisPage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateThumbnailAsync
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();
}
示例2: GetHtmlDomWithJustOnePage
private HtmlDom GetHtmlDomWithJustOnePage(IPage page)
{
var divNodeForThisPage = page.GetDivNodeForThisPage();
if (divNodeForThisPage == null)
{
throw new ApplicationException(String.Format("The requested page {0} from book {1} isn't in this book {2}.", page.Id,
page.Book.FolderPath, FolderPath));
}
return GetHtmlDomWithJustOnePage(divNodeForThisPage);
}
示例3: InsertPageAfter
public void InsertPageAfter(IPage pageBefore, IPage templatePage)
{
Guard.Against(Type != BookType.Publication, "Tried to edit a non-editable book.");
ClearPagesCache();
XmlDocument dom = OurHtmlDom.RawDom;
var templatePageDiv = templatePage.GetDivNodeForThisPage();
var newPageDiv = dom.ImportNode(templatePageDiv, true) as XmlElement;
BookStarter.SetupIdAndLineage(templatePageDiv, newPageDiv);
BookStarter.SetupPage(newPageDiv, _collectionSettings, _bookData.MultilingualContentLanguage2, _bookData.MultilingualContentLanguage3);//, LockedExceptForTranslation);
SizeAndOrientation.UpdatePageSizeAndOrientationClasses(newPageDiv, GetLayout());
newPageDiv.RemoveAttribute("title"); //titles are just for templates [Review: that's not true for front matter pages, but at the moment you can't insert those, so this is ok]C:\dev\Bloom\src\BloomExe\StyleSheetService.cs
var elementOfPageBefore = FindPageDiv(pageBefore);
elementOfPageBefore.ParentNode.InsertAfter(newPageDiv, elementOfPageBefore);
BuildPageCache();
var newPage = GetPages().First(p=>p.GetDivNodeForThisPage() == newPageDiv);
Guard.AgainstNull(newPage,"could not find the page we just added");
_pageSelection.SelectPage(newPage);
//_pageSelection.SelectPage(CreatePageDecriptor(newPageDiv, "should not show", _collectionSettings.Language1Iso639Code));
_storage.Save();
if (_pageListChangedEvent != null)
_pageListChangedEvent.Raise(null);
InvokeContentsChanged(null);
}
示例4: InsertPageAfter
public void InsertPageAfter(IPage pageBefore, IPage templatePage)
{
Guard.Against(Type != BookType.Publication, "Tried to edit a non-editable book.");
ClearPagesCache();
if(templatePage.Book !=null) // will be null in some unit tests that are unconcerned with stylesheets
HtmlDom.AddStylesheetFromAnotherBook(templatePage.Book.OurHtmlDom, OurHtmlDom);
XmlDocument dom = OurHtmlDom.RawDom;
var templatePageDiv = templatePage.GetDivNodeForThisPage();
var newPageDiv = dom.ImportNode(templatePageDiv, true) as XmlElement;
BookStarter.SetupIdAndLineage(templatePageDiv, newPageDiv);
BookStarter.SetupPage(newPageDiv, _collectionSettings, _bookData.MultilingualContentLanguage2, _bookData.MultilingualContentLanguage3);//, LockedExceptForTranslation);
SizeAndOrientation.UpdatePageSizeAndOrientationClasses(newPageDiv, GetLayout());
newPageDiv.RemoveAttribute("title"); //titles are just for templates [Review: that's not true for front matter pages, but at the moment you can't insert those, so this is ok]C:\dev\Bloom\src\BloomExe\StyleSheetService.cs
var elementOfPageBefore = FindPageDiv(pageBefore);
elementOfPageBefore.ParentNode.InsertAfter(newPageDiv, elementOfPageBefore);
BuildPageCache();
var newPage = GetPages().First(p=>p.GetDivNodeForThisPage() == newPageDiv);
Guard.AgainstNull(newPage,"could not find the page we just added");
//_pageSelection.SelectPage(CreatePageDecriptor(newPageDiv, "should not show", _collectionSettings.Language1Iso639Code));
// If copied page references images, copy them.
foreach (var pathFromBook in BookStorage.GetImagePathsRelativeToBook(newPageDiv))
{
var path = Path.Combine(FolderPath, pathFromBook);
if (!RobustFile.Exists(path))
{
var fileName = Path.GetFileName(path);
var sourcePath = Path.Combine(templatePage.Book.FolderPath, fileName);
if (RobustFile.Exists(sourcePath))
RobustFile.Copy(sourcePath, path);
}
}
//similarly, if the page has stylesheet files we don't have, copy them
foreach(string sheetName in templatePage.Book.OurHtmlDom.GetTemplateStyleSheets())
{
var destinationPath = Path.Combine(FolderPath, sheetName);
if (!File.Exists(destinationPath))
{
var sourcePath = Path.Combine(templatePage.Book.FolderPath, sheetName);
if (File.Exists(sourcePath))
File.Copy(sourcePath, destinationPath);
}
}
Save();
if (_pageListChangedEvent != null)
_pageListChangedEvent.Raise(null);
_pageSelection.SelectPage(newPage);
InvokeContentsChanged(null);
}
示例5: GetHtmlDomWithJustOnePage
private HtmlDom GetHtmlDomWithJustOnePage(IPage page)
{
var headXml = _storage.Dom.SelectSingleNodeHonoringDefaultNS("/html/head").OuterXml;
var dom = new HtmlDom(@"<html>" + headXml + "<body></body></html>");
dom = _storage.MakeDomRelocatable(dom, _log);
var body = dom.RawDom.SelectSingleNodeHonoringDefaultNS("//body");
var divNodeForThisPage = page.GetDivNodeForThisPage();
if(divNodeForThisPage==null)
{
throw new ApplicationException(String.Format("The requested page {0} from book {1} isn't in this book {2}.", page.Id,
page.Book.FolderPath, FolderPath));
}
var pageDom = dom.RawDom.ImportNode(divNodeForThisPage, true);
body.AppendChild(pageDom);
// BookStorage.HideAllTextAreasThatShouldNotShow(dom, iso639CodeToLeaveVisible, Page.GetPageSelectorXPath(dom));
return dom;
}