/// <summary> /// Adds the RSS child items. /// </summary> /// <param name="item">The blog request item.</param> /// <param name="li">The list item.</param> private static void AddRssChildItems(BlogRequest item, HtmlGenericControl li) { if (item.ItemTitles.Count <= 0 || BlogSettings.Instance.BlogrollVisiblePosts <= 0) { return; } using (var div = new HtmlGenericControl("ul")) { for (var i = 0; i < item.ItemTitles.Count; i++) { if (i >= BlogSettings.Instance.BlogrollVisiblePosts) { break; } var subLi = new HtmlGenericControl("li"); using (var a = new HtmlAnchor { HRef = item.ItemLinks[i], Title = HttpUtility.HtmlEncode(item.ItemTitles[i]), InnerHtml = EnsureLength(item.ItemTitles[i]) }) { subLi.Controls.Add(a); } div.Controls.Add(subLi); } li.Controls.Add(div); } }
/// <summary> /// Adds a blog to the item collection and start retrieving the blogs. /// </summary> /// <param name="br"> /// The blogroll item. /// </param> private static void AddBlog(BlogRollItem br) { var affected = items.FirstOrDefault(r => r.RollItem.Equals(br)); if (affected != null) { return; } var req = (HttpWebRequest)WebRequest.Create(br.FeedUrl); req.Credentials = CredentialCache.DefaultNetworkCredentials; var blogRequest = new BlogRequest(br, req); items.Add(blogRequest); req.BeginGetResponse(ProcessResponse, blogRequest); }