public XmlElement Save(XmlDocument aDocument) { XmlElement bookmarkElement = aDocument.CreateElement("Bookmark"); //@title XmlAttribute titleAttribute = aDocument.CreateAttribute("title"); titleAttribute.Value = Title; bookmarkElement.Attributes.Append(titleAttribute); //@image XmlAttribute imageAttribute = aDocument.CreateAttribute("image"); imageAttribute.Value = Image; bookmarkElement.Attributes.Append(imageAttribute); //@class XmlAttribute classAttribute = aDocument.CreateAttribute("class"); classAttribute.Value = Class; bookmarkElement.Attributes.Append(classAttribute); if (BreadcrumbTrail == null) { BreadcrumbTrail = BreadcrumbTrail.Default; } bookmarkElement.AppendChild(BreadcrumbTrail.Save(aDocument)); return(bookmarkElement); }
public static string Convert(BreadcrumbTrail aBreadcrumbTrail) { XmlDocument doc = new XmlDocument(); if (aBreadcrumbTrail != null) { doc.AppendChild(aBreadcrumbTrail.Save(doc)); } return(doc.OuterXml); }
public Bookmark(BreadcrumbTrail aBreadcrumbTrail) { BreadcrumbTrail = aBreadcrumbTrail; if (BreadcrumbTrail.Count > 0) { Title = BreadcrumbTrail[BreadcrumbTrail.Count - 1].Title; Class = string.Empty; Image = string.Empty; } }
public static BreadcrumbTrail Convert(string aBreadcrumbTrail) { BreadcrumbTrail result = BreadcrumbTrail.Default; XmlDocument doc = new XmlDocument(); try { doc.LoadXml(aBreadcrumbTrail); result.Load(doc); } catch (XmlException) { } return(result); }
public void Load(XmlNode aBookmarkNode) { if (aBookmarkNode.Attributes.GetNamedItem("title") != null) { Title = aBookmarkNode.Attributes.GetNamedItem("title").Value; } if (aBookmarkNode.Attributes.GetNamedItem("image") != null) { Image = aBookmarkNode.Attributes.GetNamedItem("image").Value; } if (aBookmarkNode.Attributes.GetNamedItem("class") != null) { Class = aBookmarkNode.Attributes.GetNamedItem("class").Value; } if (BreadcrumbTrail == null) { BreadcrumbTrail = BreadcrumbTrail.Default; } BreadcrumbTrail.Load(aBookmarkNode); }
public static Location Locate(IContainer aParentContainer, BreadcrumbTrail aBreadcrumbTrail) { Assert.Check(aBreadcrumbTrail.Count > 0); if (aBreadcrumbTrail.Count == 1) { container c = aParentContainer.Metadata; if (c.Id == aBreadcrumbTrail[0].Id || c.Title == aBreadcrumbTrail[0].Title) { return(new Location(aParentContainer)); } else { return(null); } } else { List <IContainer> candidates = FindCandidateChildren(aParentContainer, aBreadcrumbTrail[1]); foreach (IContainer candidate in candidates) { BreadcrumbTrail tail = aBreadcrumbTrail.TruncateStart(1); Location loc = Locate(candidate, tail); if (loc != null) { List <IContainer> containers = new List <IContainer>(); containers.Add(aParentContainer); for (int i = 0; i < loc.Containers.Count; i++) { containers.Add(loc.Containers[i]); } return(new Location(containers)); } } return(null); } }
public OptionBreadcrumbTrail(string aId, string aName, string aDescription, BreadcrumbTrail aDefault) : base(aId, aName, aDescription, BreadcrumbTrailConverter.Convert(aDefault)) { }
public LocatorAsync(IContainer aRootContainer, BreadcrumbTrail aBreadcrumbTrail) { iRootContainer = aRootContainer; iBreadcrumbTrail = aBreadcrumbTrail; }