public GmailRSSPost(XContainer post, IRSSFeed feed) { BelongsToFeed = feed; // Get the string properties from the post's element values Title = GetElementValue(post, "title"); Link = GetElementValue(post, "link"); if (Link == "") { Link = @"http://mail.google.com/mail/"; } Url = GetElementValue(post, "url"); Description = GetElementValue(post, "summary"); Creator = GetElementValue(post, "author"); Content = GetElementValue(post, "content"); // The Date property is a nullable DateTime? -- if the pubDate element // can't be parsed into a valid date, the Date property is set to null DateTime result; if (DateTime.TryParse(GetElementValue(post, "modified"), out result)) { Date = (DateTime?)result; } Read = false; AddedDate = DateTime.Now; IgnorePostContentIncomparison = feed.DontKeepHistory; }
private void btnDeleteRSS_Click(object sender, EventArgs e) { int feedindex = chkblstRSSItems.SelectedIndex; if (feedindex >= 0) { string msg = string.Format("How are sure you want to delete the Feed {0}?", FeedsContainer[feedindex].RSSName); var result = MessageShow.ShowMessage(this, msg, "Feed deletion confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { IRSSFeed removedFeed = FeedsContainer[feedindex]; FeedsContainer.DeleteFeed(removedFeed); chkblstRSSItems.Items.RemoveAt(feedindex); LoadFeedsForCategories(); btnDeleteRSS.Enabled = false; txtbUpdateFeedURL.Text = ""; txtbUpdateFeedName.Text = ""; txtbUpdateFeedName.Tag = null; chkbPrivate.Checked = false; OnFeedRemoval(this, new FeedArgs(removedFeed, false)); } } }
public void RemoveFeedFromAllCategories(IRSSFeed feed) { foreach (IRSSCategory rssCategory in Categories) { rssCategory.RemoveFeed(feed); } }
private void chklstbCategories_ItemCheck(object sender, ItemCheckEventArgs e) { IRSSFeed current = lstbFeedsForCategories.SelectedItem as IRSSFeed; if (current == null) { MessageShow.ShowMessage(this, "Please select feed from the left please before assigning category to a feed.", "Unable to continue", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (e.Index >= 0) { if (e.NewValue == CheckState.Checked) { IRSSCategory cat = chklstbCategories.SelectedItem as IRSSCategory; if (cat != null) { current.AddToCategory(cat); } } else if (e.NewValue == CheckState.Unchecked) { IRSSCategory cat = chklstbCategories.SelectedItem as IRSSCategory; if (cat != null) { current.RemoveFromCategory(cat); } } } }
public RSSPost(XContainer post, IRSSFeed feed) { BelongsToFeed = feed; // Get the string properties from the post's element values Title = GetElementValue(post, "title"); Link = GetElementValue(post, "link"); Url = GetElementValue(post, "guid"); Description = GetElementValue(post, "description"); Creator = GetElementValue(post, "{http://purl.org/dc/elements/1.1/}creator"); Content = GetElementValue(post, "{http://purl.org/dc/elements/1.0/modules/content}encoded"); // The Date property is a nullable DateTime? -- if the pubDate element // can't be parsed into a valid date, the Date property is set to null DateTime result; if (DateTime.TryParse(GetElementValue(post, "pubDate"), out result)) { Date = (DateTime?)result; } Read = false; AddedDate = DateTime.Now; IgnorePostContentIncomparison = feed.DontKeepHistory; }
private bool IsFeedValidOrJustAddToList(IRSSFeed newFeed) { MessageShow.ShowMessage(this, "Desktop Aggregator will now attempt to read the feed's posts. Please Wait while attempting reading", "First RSS Reading"); System.Exception newFeedExecption = null; var myDelegate = new System.EventHandler <RSSErrorArgs>(delegate(object sender, RSSErrorArgs e) { newFeedExecption = e.RSSException; }); newFeed.RSSReadingError += myDelegate; newFeed.GetAllItemsFromWeb(false, false); newFeed.RSSReadingError -= myDelegate; DialogResult result; if (newFeedExecption != null) { result = MessageShow.ShowMessage(this, "it appears there were some error reading the feed posts. The Error is: \n " + newFeedExecption.Message + "\n \n Do you still wants to add this feed?", "RSS Reading Error", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); } else { result = MessageShow.ShowMessage(this, "it appears the feed is valid so it will be added to the feeds list", "RSS Reading completed successfully", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(result == DialogResult.OK || result == DialogResult.Yes); }
private void SaveFeeds(IRSSFeed newFeed) { FeedsContainer.AddFeed(newFeed); chkblstRSSItems.Items.Add(newFeed.RSSName, newFeed.Active); OnNewFeedAdded(this, new FeedArgs(newFeed, true)); FeedsContainer.SerializeToBinaryFile(Settings.AppRSSSetings.FileName); LoadFeedsForCategories(); }
private void btnOK_Click(object sender, EventArgs e) { Encoding encoding = Encoding.UTF8; int codepage = 0; this.GmailFeed = new GmailRSSFeed(@"https://mail.google.com/mail/feed/atom", chkbPrivate.Checked, true, txtbUsername.Text, txtbPassword.Text, "", encoding, txtbFeedName.Text); this.DialogResult = DialogResult.OK; }
public void AddFeed(IRSSFeed feed) { FeedsInCategory.Add(feed); if (!feed.BelongsToCategories.Contains(this)) { feed.BelongsToCategories.Add(this); } }
public void RemoveFeed(IRSSFeed feed) { FeedsInCategory.Remove(feed); if (feed.BelongsToCategories.Contains(this)) { feed.RemoveFromCategory(this); } }
private void btnViewPosts_Click(object sender, EventArgs e) { int feedindex = chkblstRSSItems.SelectedIndex; if (feedindex >= 0) { IRSSFeed feed = FeedsContainer[feedindex]; var posts = new FeedInformationDialog(FeedsContainer, feed, Settings, !Settings.AppRSSSetings.NotifyOnRSSErrors).ShowDialog(); } }
public FeedInformationDialog(RSSFeedsContainer feedsContainer, IRSSFeed feed, AppSettings settings, bool suppressErrorDisplay) { InitializeComponent(); FeedsContainer = feedsContainer; ToolTip ttBtns = new ToolTip(); ttBtns.SetToolTip(btnDelete, "Delete the selected post"); ttBtns.SetToolTip(btnHide, "Hide/Show the selected post"); Feed = feed; Settings = settings; this.SuppressErrorDisplay = suppressErrorDisplay; }
public void AddFeed(IRSSFeed feed) { RssLock.EnterWriteLock(); try { Feeds.Add(feed); } finally { RssLock.ExitWriteLock(); } }
public StandardRSSPost(string title, string url, string link, string description, string creator, string content, DateTime?pubDate, IRSSFeed feed) { Title = title ?? string.Empty; Url = url ?? string.Empty; Link = link ?? string.Empty; Description = description ?? string.Empty; Creator = creator ?? string.Empty; Content = content ?? string.Empty; Date = pubDate; Read = false; BelongsToFeed = feed; AddedDate = DateTime.Now; IgnorePostContentInComparison = feed.DontKeepHistory; }
public IRSSFeed RemoveAt(int id) { RssLock.EnterWriteLock(); try { IRSSFeed feed = null; if (Feeds.Count() > id) { feed = Feeds[id]; Feeds.RemoveAt(id); } return(feed); } finally { RssLock.ExitWriteLock(); } }
private void lstbFeedsForCategories_SelectedIndexChanged(object sender, EventArgs e) { if (this.Visible) { IRSSFeed current = lstbFeedsForCategories.SelectedItem as IRSSFeed; if (current != null) { lblFeedForCategories.Text = "Selected feed: " + current.RSSName; chklstbCategories.ItemCheck -= chklstbCategories_ItemCheck; chklstbCategories.BeginUpdate(); for (int i = 0; i < FeedsContainer.CategoriesCount; i++) { bool belongtocategory = current.BelongsToCategories.Contains(FeedsContainer.GetCategoryAt(i)); chklstbCategories.SetItemChecked(i, belongtocategory); } chklstbCategories.EndUpdate(); chklstbCategories.ItemCheck += chklstbCategories_ItemCheck; } } }
private void btnAddRSSCustom_Click(object sender, EventArgs e) { IRSSFeed newFeed = null; if (rbCustomFeedGmail.Checked) { AddGmailFeed newGmail = new AddGmailFeed(); DialogResult result = newGmail.ShowDialog(); if (result == DialogResult.OK) { if (newGmail.GmailFeed != null) { newFeed = newGmail.GmailFeed; } } } else if (rbCustomFeedFBWall.Checked) { newFeed = new RSSFeed(@"http://www.facebook.com/feeds/page.php?id=265339816820568&format=rss20", false, true, Encoding.UTF8, "RSS Aggregator Facebook Wall"); } else if (rbCustomFeedSourceForgeFiles.Checked) { newFeed = new RSSFeed(@"https://sourceforge.net/api/file/index/project-id/595114/mtime/desc/limit/20/rss", false, true, Encoding.UTF8, "RSS Aggregator SourceForge Files"); } else if (rbCustomFeedFBReaderFBWall.Checked) { newFeed = new RSSFeed(@"http://www.facebook.com/feeds/page.php?id=217847334952654&format=rss20", false, true, Encoding.UTF8, "News Feed Reader Facebook Wall"); } else if (rbCustomFeedFBReaderSourceForgeFiles.Checked) { newFeed = new RSSFeed(@"https://sourceforge.net/api/file/index/project-id/617350/mtime/desc/limit/20/rss", false, true, Encoding.UTF8, "News Feed Reader SourceForge Files"); } if (newFeed != null && IsFeedValidOrJustAddToList(newFeed)) { SaveFeeds(newFeed); } }
public int Compare(object x, object y) { TreeNode thisNode = x as TreeNode; TreeNode otherNode = y as TreeNode; if (thisNode == null || otherNode == null) { throw new ArgumentException("Objects are not of type TreeNode"); } IRSSFeed thisFeed = thisNode.Tag as IRSSFeed; IRSSFeed otherFeed = otherNode.Tag as IRSSFeed; if (thisFeed == null || otherFeed == null) { throw new ArgumentException("Tree Node Tags are not of type IRSSFeed"); } if (!thisFeed.Disabled && otherFeed.Disabled) { return(-1); } if (thisFeed.Disabled && !otherFeed.Disabled) { return(1); } if (thisFeed.UnreadItemsCount > otherFeed.UnreadItemsCount) { return(-1); } if (thisFeed.UnreadItemsCount < otherFeed.UnreadItemsCount) { return(1); } return(thisFeed.RSSName.CompareTo(otherFeed.RSSName)); }
private AmazonProvider(IRSSFeed rSSFeed, IFeedParser feedParser) : base(rSSFeed, feedParser) { }
public async Task <List <IRSSPost> > GetRSSItemsFromFeeds(List <IRSSFeed> feedsToRefresh, bool unreadOnly, bool fromweb) { if (BusyRefreshingFromWeb) { return(null); } string oldDispalyName = DisplayFeedsName; //chkbUnreadposts.Checked = unreadOnly; //tpFeeds.Text = string.Format("Feeds Viewer (Selected Feeds: {0})", DisplayFeedsName); //tstxtbSearchFeed.Text = "Search in feeds: " + DisplayFeedsName; // LogInThisForm(string.Empty, true); //clear log OnLogOperation(this, new LogArgs(DateTime.Now + ": Start refreshing feed(s): " + DisplayFeedsName)); string refreshMsg = string.Format("Start refreshing: {0} at {1}", DisplayFeedsName, DateTime.Now); OnWebRefresh(this, new LogArgs(refreshMsg)); var posts = new List <IRSSPost>(); int i = 0; int finished = 0; foreach (var feed in feedsToRefresh) { IRSSFeed feed1 = feed; var items = await feed1.GetAllItemsFromWeb(false, !Settings.AppRSSSetings.NotifyOnRSSErrors); posts.AddRange(items); OnLogOperation(this, new LogArgs(string.Format("{0}: creating task {1} for feed {2}", DateTime.Now, i, feed1.RSSName))); var op = string.Format( "{0}: Task finished for feed {1}. Time: {2} Seconds, Download size: {3} KB. {4} new posts", DateTime.Now, feed1.RSSName, feed1.LastDownloadTime.TotalSeconds, feed1.LastDownloadSizeKb, feed1.LastNewPostsCount); OnLogOperation(this, new LogArgs(string.Format(op))); //string msg = string.Format("{0} Finished feeds: {1}/{2}", // Resources.UnReadRSSPostsReading, // ++finished, numOfTasks); //Util.Utils.UpdateControl(chkbUnreadposts, msg); //if (tasks[i1].Status == TaskStatus.RanToCompletion) //{ // var results = tasks[i1].Result.ToList(); // var unreadposts = // feed1.GetAllItemsFromCache(unreadOnly, true, true). // ToList(); // posts.AddRange(unreadposts); // DisplayPosts = posts; // if (unreadposts.Count > 0) // { // // DisplayRSSItems(DisplayPosts, dgvRSSItems); // // UpdateFeedsCountsAfterChange(); // } //} } OnWebEndRefresh(this, new LogArgs(refreshMsg)); // Util.Utils.UpdateControl(chkbUnreadposts, oldDispalyName); DisplayPosts = posts; DisplayRSSItems(unreadOnly); //UpdateFeedsCountsAfterChange(true); ulong totalFeedsKB = 0; foreach (RSSFeedsContainer rssGrouping in FeedsGroup) { foreach (var feed in rssGrouping.GetFeeds()) { totalFeedsKB += feed.TotalDownloadedKB; } } TotalDownloadedKB = totalFeedsKB; //save feeds to disk? if (Settings.AppRSSSetings.SaveRSSFeedsOnEveryRefresh && fromweb && posts.Count > 0) { SaveAllFeedsToDisk(); } // var postsarg = new RefreshArgs(posts); // OnWebRefresh(this, postsarg); //Util.Utils.UpdateControl(tpFeeds,string.Format("Feeds Viewer (Selected Feeds: {0})", oldDispalyName)); return(posts); }
public void DeleteFeed(IRSSFeed feed) { RemoveFeedFromAllCategories(feed); Feeds.Remove(feed); }
public BaseProvider(IRSSFeed rSSFeed, IFeedParser feedParser) { RSSFeed = rSSFeed; Parser = feedParser; }
public FeedArgs(IRSSFeed feed, bool newfeed) { this.Feed = feed; IsNewFeed = newfeed; }