本文整理汇总了C#中System.ServiceModel.Syndication.SyndicationItem.SetThumbnail方法的典型用法代码示例。如果您正苦于以下问题:C# SyndicationItem.SetThumbnail方法的具体用法?C# SyndicationItem.SetThumbnail怎么用?C# SyndicationItem.SetThumbnail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ServiceModel.Syndication.SyndicationItem
的用法示例。
在下文中一共展示了SyndicationItem.SetThumbnail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetItems
/// <summary>
/// Gets the collection of <see cref="SyndicationItem"/>'s that represent the atom entries.
/// </summary>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> signifying if the request is cancelled.</param>
/// <returns>A collection of <see cref="SyndicationItem"/>'s.</returns>
private async Task<List<SyndicationItem>> GetItems(CancellationToken cancellationToken)
{
List<SyndicationItem> items = new List<SyndicationItem>();
for (int i = 1; i < 4; ++i)
{
SyndicationItem item = new SyndicationItem()
{
// id (Required) - Identifies the entry using a universally unique and permanent URI. Two entries
// in a feed can have the same value for id if they represent the same entry at
// different points in time.
Id = FeedId + i,
// title (Required) - Contains a human readable title for the entry. This value should not be blank.
Title = SyndicationContent.CreatePlaintextContent("Item " + i),
// description (Recommended) - A summary of the entry.
Summary = SyndicationContent.CreatePlaintextContent("A summary of item " + i),
// updated (Optional) - Indicates the last time the entry was modified in a significant way. This
// value need not change after a typo is fixed, only after a substantial
// modification. Generally, different entries in a feed will have different
// updated timestamps.
LastUpdatedTime = DateTimeOffset.Now,
// published (Optional) - Contains the time of the initial creation or first availability of the entry.
PublishDate = DateTimeOffset.Now,
// rights (Optional) - Conveys information about rights, e.g. copyrights, held in and over the entry.
Copyright = new TextSyndicationContent(
string.Format("© {0} - {1}", DateTime.Now.Year, Application.Name)),
};
// link (Recommended) - Identifies a related Web page. An entry must contain an alternate link if there
// is no content element.
item.Links.Add(SyndicationLink.CreateAlternateLink(
new Uri(this.urlHelper.AbsoluteRouteUrl(HomeControllerRoute.GetIndex)),
ContentType.Html));
// AND/OR
// Text content (Optional) - Contains or links to the complete content of the entry. Content must be
// provided if there is no alternate link.
// item.Content = SyndicationContent.CreatePlaintextContent("The actual plain text content of the entry");
// HTML content (Optional) - Content can be plain text or HTML. Here is a HTML example.
// item.Content = SyndicationContent.CreateHtmlContent("The actual HTML content of the entry");
// author (Optional) - Names one author of the entry. An entry may have multiple authors. An entry must
// contain at least one author element unless there is an author element in the
// enclosing feed, or there is an author element in the enclosed source element.
item.Authors.Add(this.GetPerson());
// contributor (Optional) - Names one contributor to the entry. An entry may have multiple contributor elements.
item.Contributors.Add(this.GetPerson());
// category (Optional) - Specifies a category that the entry belongs to. A entry may have multiple
// category elements.
item.Categories.Add(new SyndicationCategory("CategoryName"));
// link - Add additional links to related images, audio or video like so.
item.Links.Add(SyndicationLink.CreateMediaEnclosureLink(
new Uri(this.urlHelper.AbsoluteContent("~/content/icons/atom-icon-48x48.png")),
ContentType.Png,
0));
// media:thumbnail - Add a Yahoo Media thumbnail for the entry. See http://www.rssboard.org/media-rss
// for more information.
item.SetThumbnail(this.urlHelper.AbsoluteContent("~/content/icons/atom-icon-48x48.png"), 48, 48);
items.Add(item);
}
return items;
}