public ComparisonUnitGroup( IEnumerable <ComparisonUnit> comparisonUnitList, ComparisonUnitGroupType groupType, int level) { Contents = comparisonUnitList.ToList(); ComparisonUnitGroupType = groupType; ComparisonUnit first = Contents.First(); ComparisonUnitAtom comparisonUnitAtom = GetFirstComparisonUnitAtomOfGroup(first); XElement[] ancestorsToLookAt = comparisonUnitAtom .AncestorElements .Where(e => e.Name == W.tbl || e.Name == W.tr || e.Name == W.tc || e.Name == W.p || e.Name == W.txbxContent) .ToArray(); XElement ancestor = ancestorsToLookAt[level]; if (ancestor == null) { throw new OpenXmlPowerToolsException("Internal error: ComparisonUnitGroup"); } SHA1Hash = (string)ancestor.Attribute(PtOpenXml.SHA1Hash); CorrelatedSHA1Hash = (string)ancestor.Attribute(PtOpenXml.CorrelatedSHA1Hash); StructureSHA1Hash = (string)ancestor.Attribute(PtOpenXml.StructureSHA1Hash); }
public void Reset() { Latest.Clear(); if (Site != null) { Latest.Add(Contents.First(p => p.ContentLink.Equals(Site.StartPage, true))); } }
public void RemovePage(PageViewModel page) { Contents.Remove(page); if (FirstPage.ID == page.ID) { if (Contents.Count > 0) { FirstPage = Contents.First(); } else { FirstPage = null; } } }
public void LoadBook(int bookId, bool append = false) { var epubBook = bookModel.OpenBook(bookId); Contents = Contents.AddRange(bookModel.GetChapters(epubBook)); images = images.AddRange(epubBook.Content.Images.ToDictionary(imageFile => imageFile.Key, imageFile => imageFile.Value.Content)); styleSheets = styleSheets.AddRange(epubBook.Content.Css.ToDictionary(cssFile => cssFile.Key, cssFile => cssFile.Value.Content)); fonts = fonts.AddRange(epubBook.Content.Fonts.ToDictionary(fontFile => fontFile.Key, fontFile => fontFile.Value.Content)); selectChapterCommand = null; selectedChapter = null; selectedChapterContent = null; if (Contents.Any()) { SelectChapter(Contents.First()); } }
private decimal GetBreadDiscount() { var bread = Contents.First(p => string.Compare(p.Name, Bread.ProductName, true) == 0); return(bread.Price / 2); }