Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
            public static string Convert(BreadcrumbTrail aBreadcrumbTrail)
            {
                XmlDocument doc = new XmlDocument();

                if (aBreadcrumbTrail != null)
                {
                    doc.AppendChild(aBreadcrumbTrail.Save(doc));
                }
                return(doc.OuterXml);
            }
Exemplo n.º 3
0
 public Bookmark(BreadcrumbTrail aBreadcrumbTrail)
 {
     BreadcrumbTrail = aBreadcrumbTrail;
     if (BreadcrumbTrail.Count > 0)
     {
         Title = BreadcrumbTrail[BreadcrumbTrail.Count - 1].Title;
         Class = string.Empty;
         Image = string.Empty;
     }
 }
Exemplo n.º 4
0
            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);
            }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
0
 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);
     }
 }
Exemplo n.º 7
0
 public OptionBreadcrumbTrail(string aId, string aName, string aDescription, BreadcrumbTrail aDefault)
     : base(aId, aName, aDescription, BreadcrumbTrailConverter.Convert(aDefault))
 {
 }
Exemplo n.º 8
0
 public LocatorAsync(IContainer aRootContainer, BreadcrumbTrail aBreadcrumbTrail)
 {
     iRootContainer   = aRootContainer;
     iBreadcrumbTrail = aBreadcrumbTrail;
 }