当前位置: 首页>>代码示例>>C#>>正文


C# Syndication.SyndicationItem类代码示例

本文整理汇总了C#中System.ServiceModel.Syndication.SyndicationItem的典型用法代码示例。如果您正苦于以下问题:C# SyndicationItem类的具体用法?C# SyndicationItem怎么用?C# SyndicationItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SyndicationItem类属于System.ServiceModel.Syndication命名空间,在下文中一共展示了SyndicationItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetJobs

        public SyndicationFeedFormatter GetJobs(string format)
        {
            var groups = _Scheduler.GetJobGroupNames();
            SyndicationFeed feed = new SyndicationFeed();
            List<SyndicationItem> items = new List<SyndicationItem>();
            foreach (var group in groups)
            {
                var jobKeys = _Scheduler.GetJobKeys(GroupMatcher<JobKey>.GroupEquals(group));

                foreach (var jobKey in jobKeys)
                {
                    var job = _Scheduler.GetJobDetail(jobKey);
                    SyndicationItem item = new SyndicationItem();
                    item.Id = job.Key.ToString();
                    item.LastUpdatedTime = DateTime.UtcNow;
                    item.Title = new TextSyndicationContent(string.Format("{0} - {1}", job.Key.Group, job.Key.Name), TextSyndicationContentKind.Plaintext);
                    item.Summary = new TextSyndicationContent(string.Format("Job {0} for group {1}.", job.Key.Name, job.Key.Group), TextSyndicationContentKind.Plaintext);
                    items.Add(item);
                }

            }
            feed.Items = items;
            SyndicationFeedFormatter formatter = new Rss20FeedFormatter(feed);

            return formatter;
        }
开发者ID:GoneFishern,项目名称:QuartzNetFeaturePack,代码行数:26,代码来源:FeedService.cs

示例2: ProcessFeedSource

        public static SyndicationFeed ProcessFeedSource( string feedSource )
        {
            HtmlElement rootElement = HtmlElement.Create( feedSource );

            // identify the row container
            HtmlElement container = GetRowContainer( rootElement );

            // identify the rows and pass them into a list
            IList<HtmlElement> elementList = GetElementList( container );

            var items = new List<SyndicationItem>();

            //find all the headlines
            foreach (HtmlElement element in elementList)
            {
                //find the first link within the div
                HtmlAnchorElement link = (HtmlAnchorElement)element.ChildElements.Find( "a", 0 );

                string title = GetFeedItemTitle( link );
                string hRef = GetFeedItemLink( link );
                DateTime publishedTime = GetFeedItemPublishedTime();
                string summary = GetFeedItemSummary();
                DateTime lastUpdatedTime = GetFeedItemLastUpdatedTime();

                var syndicationItem = new SyndicationItem( title, string.Empty, new Uri( hRef ), hRef, lastUpdatedTime );
                syndicationItem.Summary = new TextSyndicationContent( summary, TextSyndicationContentKind.XHtml );
                syndicationItem.PublishDate = publishedTime;

                items.Add( syndicationItem );


            }

            return new SyndicationFeed( items );
        }
开发者ID:j3itchtits,项目名称:jumblist,代码行数:35,代码来源:BbcCustomHttpFeed.cs

示例3: GetSyndicationFeed

        /// <summary>
        /// Turn a SimpleFeed object into a SyndicationFeed object
        /// </summary>
        private SyndicationFeed GetSyndicationFeed(SimpleFeed pFeed)
        {
            var feed = new SyndicationFeed();
            var items = new List<SyndicationItem>();

            feed.BaseUri = new Uri(pFeed.BaseUrl);
            if (!string.IsNullOrWhiteSpace(pFeed.Title))
                feed.Title = new TextSyndicationContent(pFeed.Title);
            if (!string.IsNullOrWhiteSpace(pFeed.Description))
                feed.Description = new TextSyndicationContent(pFeed.Description);
            if (!string.IsNullOrWhiteSpace(pFeed.Language))
                feed.Language = pFeed.Language;

            if (pFeed.Entries != null)
            {
                foreach (var entry in pFeed.Entries)
                {
                    var item = new SyndicationItem(entry.Title, entry.Body, entry.TitleLinkUri);
                    //Id, DatePublished, DateLastUpdated are required so that each new post won't make readers think that every entry is new
                    item.Id = entry.Id;
                    item.PublishDate = entry.DatePublished;
                    item.LastUpdatedTime = entry.DateLastUpdated;
                    item.BaseUri = entry.TitleLinkUri;
                    items.Add(item);
                }
            }

            feed.Items = items;
            return feed;
        }
开发者ID:akmurray,项目名称:aaronkmurray-blog-tools,代码行数:33,代码来源:SimpleFeedConverter.cs

示例4: ActivityFeed

        public ActionResult ActivityFeed(string name, int id)
        {
            var polfeed = _polRep.LatestFeed(id, includeposts);
            List<SyndicationItem> items = new List<SyndicationItem>();
            var pol = _polRep.GetPoliticianById(id);
            var polLink = this.Request.Url.GetLeftPart(UriPartial.Authority) + pol.PolLink(this);

            SyndicationFeed feed =
                new SyndicationFeed(
                        String.Format("{0} Feed", pol.FullName()), "Activity Feed på Folkets Ting",
                        new Uri(Request.Url.ToString()),
                        Request.Url.AbsoluteUri,
                        polfeed.Last().date);

            foreach (var feeditem in polfeed)
            {
                var link = (this.Request.Url.GetLeftPart(UriPartial.Authority) + feeditem.ActionUrl);
                SyndicationItem item =
                    new SyndicationItem(feeditem.ActionText,
                                    feeditem.BodyText,
                                    new Uri(link),
                                    feeditem.ActionUrl + feeditem.ActionText,
                                    feeditem.date);
                items.Add(item);
            }
            feed.Items = items;

            return new RssActionResult() { Feed = feed };
        }
开发者ID:friism,项目名称:folketsting,代码行数:29,代码来源:PoliticianController.cs

示例5: ToFeed

        /// <summary>
        /// Create the feed 
        /// </summary>
        /// <returns>The created feed</returns>
        public override SyndicationFeed ToFeed()
        {
            SyndicationFeed feed = new SyndicationFeed(Title, Title, new Uri(Uri), Id, DateTime.Parse(Updated.At));
            //feed.Authors.Add(new SyndicationPerson("[email protected]"));
            feed.Categories.Add(new SyndicationCategory(Title));
            feed.Description = new TextSyndicationContent(Title);

            List<SyndicationItem> items = new List<SyndicationItem>();
            if (commentList != null && commentList.comments != null)
            {
                for (int i = 0; i < commentList.comments.Count; i++)
                {
                    SyndicationItem item = new SyndicationItem(
                    "",
                    commentList.comments[i].text,
                    new Uri(commentList.comments[i].Uri),
                    commentList.comments[i].ID.ToString(),
                    DateTime.Parse(commentList.comments[i].Created.At));
                    items.Add(item);
                }

            }
            feed.Items = items;
            return feed;


        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:31,代码来源:CommentForum.Contract.cs

示例6: set_the_title

        public void set_the_title()
        {
            var subject = new ItemSubject(){
                Title = "first",
                Title2 = "second"
            };

            var target = new SimpleValues<ItemSubject>(subject);

            var map1 = new FeedItem<ItemSubject>();
            map1.Title(x => x.Title);

            var map2 = new FeedItem<ItemSubject>();
            map2.Title(x => x.Title2);

            var item1 = new SyndicationItem();
            map1.As<IFeedItem<ItemSubject>>().ConfigureItem(item1, target);
            item1.Title.Text.ShouldEqual(subject.Title);


            var item2 = new SyndicationItem();
            map2.As<IFeedItem<ItemSubject>>().ConfigureItem(item2, target);
            item2.Title.Text.ShouldEqual(subject.Title2);

        }
开发者ID:ahjohannessen,项目名称:FubuMVC.Media,代码行数:25,代码来源:FeedItemTester.cs

示例7: CreateFeed

        public SyndicationFeedFormatter CreateFeed()
        {
            // Create a new Syndication Feed.
            SyndicationFeed feed = new SyndicationFeed("Feed Title", "A WCF Syndication Feed", null);
            List<SyndicationItem> items = new List<SyndicationItem>();

            // Create a new Syndication Item.
            SyndicationItem item = new SyndicationItem("An item", "Item content", null);
            items.Add(item);
            feed.Items = items;

            // Return ATOM or RSS based on query string
            // rss -> http://localhost:8733/Design_Time_Addresses/SyndicationServiceLibrary1/Feed1/
            // atom -> http://localhost:8733/Design_Time_Addresses/SyndicationServiceLibrary1/Feed1/?format=atom
            string query = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["format"];
            SyndicationFeedFormatter formatter = null;
            if (query == "atom")
            {
                formatter = new Atom10FeedFormatter(feed);
            }
            else
            {
                formatter = new Rss20FeedFormatter(feed);
            }

            return formatter;
        }
开发者ID:hkuntal,项目名称:MySociety,代码行数:27,代码来源:Feed1.cs

示例8: CreateFeedForBlog

        public SyndicationFeedFormatter CreateFeedForBlog(string user, string blog)
        {
            SyndicationFeed feed = new SyndicationFeed("Blog feed", "A feed linked to a blog", null);
            List<SyndicationItem> items = new List<SyndicationItem>();
            List<Dbo.RssArticle> articles = BusinessManagement.Feed.GetBlogContent(user, blog);

            foreach (Dbo.RssArticle article in articles)
            {
                SyndicationItem item = new SyndicationItem(article.Title, article.Content, null);
                item.PublishDate = article.CreationDate;
                items.Add(item);
            }
            feed.Items = items;

            // Renvoie ATOM ou RSS en fonction de la chaîne de requête
            // rss -> http://localhost:8733/Design_Time_Addresses/FluxRss/Feed1/
            // atom -> http://localhost:8733/Design_Time_Addresses/FluxRss/Feed1/?format=atom
            string query = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["format"];
            SyndicationFeedFormatter formatter = null;
            if (query == "atom")
            {
                formatter = new Atom10FeedFormatter(feed);
            }
            else
            {
                formatter = new Rss20FeedFormatter(feed);
            }

            return formatter;
        }
开发者ID:ThomasCOLLIN,项目名称:dotNET,代码行数:30,代码来源:Feed.cs

示例9: Rss

        public ActionResult Rss(string domain="")
        {
            var news = NewsProvider.GetSeason(2014, domain).OrderByDescending(n=>n.Date).Take(10);

            var feedItems = new List<SyndicationItem>();
            foreach (var news_item in news)
            {
                var item = new SyndicationItem()
                {
                    Title = TextSyndicationContent.CreatePlaintextContent(news_item.Title),
                    PublishDate = new DateTimeOffset(news_item.Date),
                    Summary = TextSyndicationContent.CreateHtmlContent(CombineBriefWithImage(news_item)),
                };
                string url = "http://afspb.org.ru/news/" + news_item.Slug;

                var link = new SyndicationLink(new Uri(url));
                link.Title = "Перейти к новости";
                item.Links.Add(link);
                feedItems.Add(item);
            }

            var feed = new SyndicationFeed(
                    "Новости сайта Автомобильной Федерации Санкт-Петербурга и Ленинградской области",
                    "",
                    new Uri("http://afspb.org.ru/news/Rss"),
                    feedItems);

            return new RssResult()
            {
                Feed = feed
            };
        }
开发者ID:rallysportphoto,项目名称:Portal,代码行数:32,代码来源:NewsController.cs

示例10: GetFeed

        public Rss20FeedFormatter GetFeed()
        {
            List<News> news = NewsRepository.GetNews();

            var feed = new SyndicationFeed("Nieuwsoverzicht van het festival", "Description", new Uri("http://localhost:8080"));
            feed.Authors.Add(new SyndicationPerson("Festival naam"));
            feed.Categories.Add(new SyndicationCategory("Festival"));
            feed.Description = new TextSyndicationContent("This is a how to sample that demonstrates how to expose a feed using RSS with WCF");

            List<SyndicationItem> items = new List<SyndicationItem>();
            foreach (News n in news)
            {
                SyndicationItem item = new SyndicationItem(
                n.Title,
                n.Content,
                new Uri("http://localhost:51172/"),
                n.Id,
                n.Date);
                item.Authors.Add(new SyndicationPerson(n.Author));

                items.Add(item);
            }
            feed.Items = items;

            return new Rss20FeedFormatter(feed);
        }
开发者ID:Neirijnck,项目名称:FestivalSite,代码行数:26,代码来源:RSSController.cs

示例11: GetFeed

        public Atom10FeedFormatter GetFeed(int id)
        {
            SyndicationFeed feed = new SyndicationFeed("Atom Feed", "This is a test feed", new Uri("http://SomeURI"), "FeedOneID", new DateTimeOffset(DateTime.Now));
            feed.Authors.Add(new SyndicationPerson("[email protected]"));
            feed.Categories.Add(new SyndicationCategory("How To Sample Code"));
            feed.Description = new TextSyndicationContent("This is a sample that illistrates how to expose a feed using ATOM with WCF");

            SyndicationItem item1 = new SyndicationItem(
                "Item One",
                "This is the content for item one",
                new Uri("http://localhost/Content/One"),
                "ItemOneID",
                DateTime.Now);

            SyndicationItem item2 = new SyndicationItem(
                "Item Two",
                "This is the content for item two",
                new Uri("http://localhost/Content/Two"),
                "ItemTwoID",
                DateTime.Now);

            List<SyndicationItem> items = new List<SyndicationItem>();

            items.Add(item1);
            items.Add(item2);

            feed.Items = items;
            return new Atom10FeedFormatter(feed);
        }
开发者ID:rymeri,项目名称:mvctutorials,代码行数:29,代码来源:RssFeedController.cs

示例12: ExecuteResult

		/// <summary>
		/// Executes the syndication result on the given context.
		/// </summary>
		/// <param name="context">The current context.</param>
		public override void ExecuteResult(ControllerContext context) {
			var response = context.HttpContext.Response;
			var writer = new XmlTextWriter(response.OutputStream, Encoding.UTF8);

			// Write headers
			response.ContentType = ContentType;
			response.ContentEncoding = Encoding.UTF8;

			var feed = new SyndicationFeed() { 
				Title = new TextSyndicationContent(Config.Blog.Title),
				LastUpdatedTime = Posts.First().Published.Value,
				Description = new TextSyndicationContent(Config.Blog.Description),
			};
			feed.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(Utils.AbsoluteUrl("~/"))));

			var items = new List<SyndicationItem>();
			foreach (var post in Posts) {
				var item = new SyndicationItem() { 
					Title = SyndicationContent.CreatePlaintextContent(post.Title),
					PublishDate = post.Published.Value,
					Summary = SyndicationContent.CreateHtmlContent(post.Html.ToHtmlString())
				};
				item.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(Utils.AbsoluteUrl("~/" + post.Slug))));
				items.Add(item);
			}
			feed.Items = items;

			var formatter = GetFormatter(feed);
			formatter.WriteTo(writer);

			writer.Flush();
			writer.Close();
		}
开发者ID:nguyenhoangthanh,项目名称:Goldfish,代码行数:37,代码来源:SyndicationResult.cs

示例13: FormatLogEntry

        private SyndicationItem FormatLogEntry(LogEntry entry, string repo)
        {
            var markdownParser = new Markdown(true);
            var item = new SyndicationItem();

            item.Id = entry.CommitHash;
            item.Title = new TextSyndicationContent(entry.Subject);
            item.Content = SyndicationContent.CreateHtmlContent(markdownParser.Transform(entry.Subject + "\n\n" + entry.Body));
            item.LastUpdatedTime = entry.AuthorDate;
            item.PublishDate = entry.CommitterDate;

            item.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(Url.Action("ViewCommit", "Browse", new { repo, @object = entry.CommitHash }), UriKind.Relative)));

            item.Categories.Add(new SyndicationCategory("commit"));
            if (entry.Parents.Count > 1)
            {
                item.Categories.Add(new SyndicationCategory("merge"));
            }

            item.Authors.Add(new SyndicationPerson(entry.AuthorEmail, entry.Author, null));
            if (entry.Author != entry.Committer || entry.AuthorEmail != entry.CommitterEmail)
            {
                item.Contributors.Add(new SyndicationPerson(entry.CommitterEmail, entry.Committer, null));
            }

            return item;
        }
开发者ID:JasSra,项目名称:WebGitNet,代码行数:27,代码来源:SyndicationController.cs

示例14: RSS

        private RssActionResult RSS(Func<V1FeedPackage, bool> exclude)
        {
            var nugetODataUrl = new Uri("http://packages.nuget.org/v1/FeedService.svc");
            var nugetOData = new FeedContext_x0060_1(nugetODataUrl);

            var packages = nugetOData.Packages.OrderByDescending(p => p.Published);
            var nugetFeed = new List<SyndicationItem>();

            foreach (var package in packages)
            {
                if (exclude(package)) continue;

                var syndicationItem = new SyndicationItem(
                    package.Title,
                    package.Description,
                    new Uri(package.ProjectUrl ?? package.GalleryDetailsUrl),
                    package.Id,
                    package.LastUpdated);
                nugetFeed.Add(syndicationItem);
            }

            return new RssActionResult
            {
                Feed = new SyndicationFeed(
                    "NuGet Feed",
                    "NuGet OData feed converted to RSS",
                    new Uri("http://www.nugetfeed.com/"),
                    "urn:uuid:f4df456c-6643-4c53-a6e5-f180ce6e030d",
                    nugetFeed.First().LastUpdatedTime,
                    nugetFeed)
            };
        }
开发者ID:vladkosarev,项目名称:NugetFeed,代码行数:32,代码来源:NugetFeedController.cs

示例15: FeedActionResult

        /// <summary>
        /// Initializes a new instance of the FeedActionResult class
        /// </summary>
        /// <param name="blogName">Name of the blog</param>
        /// <param name="description">Feed description</param>
        /// <param name="format">Format of the feed</param>
        /// <param name="url">A URL Helper</param>
        /// <param name="posts">The posts to include in the feed</param>
        public FeedActionResult(string blogName, string description, FeedFormat format, UrlHelper url, IEnumerable<BlogPost> posts)
        {
            Guid blogPostId;
            string postRelative;
            SyndicationItem item;
            List<SyndicationItem> items = new List<SyndicationItem>();

            // Specify the type of feed
            Format = format;

            // Initialize the current feed
            Feed = new SyndicationFeed(blogName, description, new Uri(url.RouteUrl("Default"), UriKind.Relative));

            //load the posts as items
            foreach (BlogPost post in posts)
            {
                blogPostId = post.BlogPostId;
                postRelative = url.Action(
                    "Details", "Posts",
                    new
                    {
                        year = post.PostedDate.Value.Year,
                        month = post.PostedDate.Value.Month,
                        day = post.PostedDate.Value.Day,
                        id = blogPostId
                    });

                item = new SyndicationItem(post.Title, post.Post,
                    new Uri(postRelative, UriKind.Relative), post.BlogPostId.ToString(), post.PostedDate.Value);

                items.Add(item);
            }

            Feed.Items = items.OrderByDescending(x => x.LastUpdatedTime);
        }
开发者ID:senfo,项目名称:FrogBlogger,代码行数:43,代码来源:FeedActionResult.cs


注:本文中的System.ServiceModel.Syndication.SyndicationItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。