本文整理汇总了C#中PivotItem.AddRelatedLink方法的典型用法代码示例。如果您正苦于以下问题:C# PivotItem.AddRelatedLink方法的具体用法?C# PivotItem.AddRelatedLink怎么用?C# PivotItem.AddRelatedLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PivotItem
的用法示例。
在下文中一共展示了PivotItem.AddRelatedLink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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());
}
示例2: 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;
}