本文整理汇总了C#中PivotItem.AddFacetValues方法的典型用法代码示例。如果您正苦于以下问题:C# PivotItem.AddFacetValues方法的具体用法?C# PivotItem.AddFacetValues怎么用?C# PivotItem.AddFacetValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PivotItem
的用法示例。
在下文中一共展示了PivotItem.AddFacetValues方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestAddFacetValueExistingFacetCategory
public void TestAddFacetValueExistingFacetCategory()
{
emptyCollection.FacetCategories.Add(new PivotFacetCategory("bravo", PivotFacetType.String));
PivotItem item = new PivotItem("alpha", emptyCollection);
item.AddFacetValues("bravo", "charlie");
item.AddFacetValues("bravo", "delta");
AssertEqual("charlie", item.GetAllFacetValues("bravo")[0]);
AssertEqual("delta", item.GetAllFacetValues("bravo")[1]);
AssertEqual(2, item.GetAllFacetValues("bravo").Count);
AssertEqual(1, item.FacetCategories.Count());
}
示例2: TestBrokenRelatedLinks
public void TestBrokenRelatedLinks()
{
PivotCollection collection = new PivotCollection();
collection.FacetCategories.Add(new PivotFacetCategory("alpha", PivotFacetType.String));
PivotItem item = new PivotItem("0", collection);
item.AddFacetValues("alpha", "alpha");
item.AddRelatedLink(new PivotLink(null, "http://pauthor.codeplex.com"));
collection.Items.Add(item);
item = new PivotItem("1", collection);
item.AddFacetValues("alpha", "bravo");
item.AddRelatedLink(new PivotLink("charlie", null));
collection.Items.Add(item);
PivotCollectionBuffer buffer = new PivotCollectionBuffer(collection);
String targetPath = Path.Combine(WorkingDirectory, "sample.cxml");
LocalCxmlCollectionTarget target = new LocalCxmlCollectionTarget(targetPath);
target.Write(buffer);
AssertCxmlSchemaValid(targetPath);
CxmlCollectionSource targetAsSource = new CxmlCollectionSource(targetPath);
buffer.Write(targetAsSource);
AssertEqual("Related Link", buffer.Collection.Items[0].RelatedLinks.First().Title);
AssertEqual("http://pauthor.codeplex.com", buffer.Collection.Items[0].RelatedLinks.First().Url);
AssertEqual(0, buffer.Collection.Items[1].RelatedLinks.Count());
}
示例3: ParseFacet
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));
}
}
}
}
示例4: ReadItem
private PivotItem ReadItem(OleDbDataReader dataReader, int rowId)
{
PivotItem item = new PivotItem(rowId.ToString(), this);
for (int column = 0; column < dataReader.FieldCount; column++)
{
if (dataReader.IsDBNull(column)) continue;
String columnName = dataReader.GetName(column).ToLowerInvariant();
String value = dataReader.GetValue(column).ToString();
if (String.IsNullOrEmpty(value)) continue;
if (columnName == OleDbSchemaConstants.Item.Name)
{
item.Name = value;
}
else if (columnName == OleDbSchemaConstants.Item.Image)
{
String imagePath = UriUtility.ExpandRelativeUri(this.BasePath, value);
item.Image = new PivotImage(imagePath);
}
else if (columnName == OleDbSchemaConstants.Item.Description)
{
item.Description = value;
}
else if (columnName == OleDbSchemaConstants.Item.Href)
{
item.Href = value;
}
else if (columnName == OleDbSchemaConstants.Item.RelatedLinks)
{
StringReader valueReader = new StringReader(value);
String singleValue = null;
while ((singleValue = valueReader.ReadLine()) != null)
{
String[] parts = singleValue.Split(
new String[] { OleDbSchemaConstants.LinkPartDelimiter }, StringSplitOptions.None);
if (parts.Length > 0)
{
String name = null, url = null;
if (parts.Length == 1)
{
url = parts[0];
}
else if (parts.Length >= 2)
{
name = parts[0];
url = parts[1];
}
item.AddRelatedLink(new PivotLink(name, url));
}
}
}
else
{
PivotFacetCategory facetCategory = null;
foreach (PivotFacetCategory currentFacetCategory in m_facetCategoryMap.Values)
{
if (columnName == currentFacetCategory.Name.Replace('.', '#').ToLowerInvariant())
{
facetCategory = currentFacetCategory;
break;
}
}
if (facetCategory != null)
{
item.AddFacetValues(facetCategory.Name, this.SplitJoinedStrings(value).ToArray());
}
}
}
return item;
}
示例5: LoadItems
protected override IEnumerable<PivotItem> LoadItems()
{
XPathHelper document = null;
using (WebClient webClient = new WebClient())
{
document = new XPathHelper(webClient.DownloadString(this.BasePath));
}
int index = 0;
foreach (XPathHelper itemNode in document.FindNodes("//item"))
{
PivotItem item = new PivotItem(index.ToString(), this);
String value = null;
if (itemNode.TryFindString("title", out value))
{
item.Name = value;
}
if (itemNode.TryFindString("description", out value))
{
item.Description = value;
}
if (itemNode.TryFindString("link", out value))
{
item.Href = value;
}
if (itemNode.TryFindString("author", out value))
{
item.AddFacetValues("Author", value);
}
foreach (XPathHelper categoryNode in itemNode.FindNodes("category"))
{
item.AddFacetValues("Category", categoryNode.FindString("."));
}
if (itemNode.TryFindString("pubDate", out value))
{
DateTime dateValue = DateTime.Now;
if (DateTime.TryParse(value, out dateValue))
{
item.AddFacetValues("Date", dateValue);
}
}
yield return item;
index++;
}
}