/// <summary> /// Adds a new related link to this item. /// </summary> /// <param name="link">the link to be added</param> /// <exception cref="ArgumentNullException">if the given value is null</exception> public void AddRelatedLink(PivotLink link) { if (link == null) { throw new ArgumentNullException("Link"); } m_relatedLinks.Add(link); }
/// <summary> /// Compares the current instance with another object of the same type and returns an integer that indicates /// whether the current instance precedes, follows, or occurs in the same position in the sort order as the /// other object. /// </summary> /// <remarks> /// This method first compares the titles of the two links, and then compares the URLs. /// </remarks> /// <param name="obj">An object to compare with this instance.</param> /// <returns>A value that indicates the relative order of the objects being compared.</returns> /// <exception cref="ArgumentException">if the given value is not a PivotLink</exception> public int CompareTo(Object obj) { if ((obj is PivotLink) == false) { throw new ArgumentException("Invalid type: " + obj.GetType()); } PivotLink that = (PivotLink)obj; int result = String.Compare(this.Title, that.Title); if (result != 0) { return(result); } return(String.Compare(this.Url, that.Url)); }
private List<PivotLink> ParseRelatedLinks(XmlReader xmlReader) { List<PivotLink> relatedLinks = new List<PivotLink>(); while (xmlReader.Read()) { if (xmlReader.NodeType != XmlNodeType.Element) continue; if (xmlReader.LocalName == "Link") { PivotLink link = new PivotLink(xmlReader.GetAttribute("Name"), xmlReader.GetAttribute("Href")); relatedLinks.Add(link); } } return relatedLinks; }
private void ParseFacet(XmlReader xmlReader, PivotItem item) { PivotCollection cachedData = this.CachedCollectionData; String facetCategoryName = null; PivotFacetType facetType = null; while (xmlReader.Read()) { if (xmlReader.NodeType != XmlNodeType.Element) continue; if (xmlReader.LocalName == "Facet") { facetCategoryName = xmlReader.GetAttribute("Name"); PivotFacetCategory facetCategory = cachedData.FacetCategories[facetCategoryName]; facetType = facetCategory.Type; } else if ((facetType != null) && (xmlReader.LocalName == facetType.ToString())) { if (facetType == PivotFacetType.Link) { PivotLink link = new PivotLink(xmlReader.GetAttribute("Name"), xmlReader.GetAttribute("Href")); item.AddFacetValues(facetCategoryName, link); } else { String value = xmlReader.GetAttribute("Value"); item.AddFacetValues(facetCategoryName, facetType.ParseValue(value)); } } } }
public override IComparable ParseValue(String value) { return(PivotLink.ParseValue(value)); }