private void HandleFeedLabelMouseDown(object sender, MouseButtonEventArgs e) { // Open the link for the current feed on a left double click if (e.ClickCount == 2 && e.ChangedButton == MouseButton.Left) { BrowserCommon.OpenLink(_currentFeed.Link); } }
private void HandleItemMouseDoubleClick(object sender, MouseButtonEventArgs e) { // Get the feed item var feedItem = (FeedItem)((ListBoxItem)sender).DataContext; // Open the item link if (BrowserCommon.OpenLink(feedItem.Link)) { // The feed item has been read and is no longer new feedItem.BeenRead = true; feedItem.New = false; // Remove the item from the list LinkTextList.Items.Remove(feedItem); // Save the changes _database.SaveChanges(); } }
private void OpenAllFeedItemsIndividually() { // Create a new list of feed items var feedItems = (from FeedItem feedItem in LinkTextList.Items select feedItem).ToList(); // Get the browser var browser = BrowserCommon.FindBrowser(Settings.Default.Browser); // Cache the settings object var settings = Settings.Default; // Start with a longer sleep interval to give time for the browser to come up var sleepInterval = settings.OpenAllSleepIntervalFirst; // Loop over all items foreach (var feedItem in feedItems) { // Try to open the link if (BrowserCommon.OpenLink(browser, feedItem.Link)) { // Mark the feed as read feedItem.BeenRead = true; // Remove the item LinkTextList.Items.Remove(feedItem); } // Wait a little bit Thread.Sleep(sleepInterval); // Switch to the normal sleep interval sleepInterval = settings.OpenAllSleepInterval; } // Save the changes _database.SaveChanges(); }
private void OpenAllFeedItemsOnSinglePage() { var fileName = Path.GetTempFileName() + ".html"; TextWriter textWriter = new StreamWriter(fileName); using (var htmlTextWriter = new HtmlTextWriter(textWriter)) { htmlTextWriter.RenderBeginTag(HtmlTextWriterTag.Html); htmlTextWriter.RenderBeginTag(HtmlTextWriterTag.Head); htmlTextWriter.RenderBeginTag(HtmlTextWriterTag.Title); htmlTextWriter.Write(_currentFeed.Title); htmlTextWriter.RenderEndTag(); htmlTextWriter.AddAttribute("http-equiv", "Content-Type"); htmlTextWriter.AddAttribute("content", "text/html; charset=utf-8"); htmlTextWriter.RenderBeginTag(HtmlTextWriterTag.Meta); htmlTextWriter.RenderEndTag(); htmlTextWriter.RenderEndTag(); htmlTextWriter.RenderBeginTag(HtmlTextWriterTag.Body); var sortedItems = from item in _currentFeed.Items where !item.BeenRead orderby item.Sequence ascending select item; var firstItem = true; foreach (var item in sortedItems) { if (!firstItem) { htmlTextWriter.RenderBeginTag(HtmlTextWriterTag.Hr); htmlTextWriter.RenderEndTag(); } htmlTextWriter.RenderBeginTag(HtmlTextWriterTag.Div); htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Href, item.Link); htmlTextWriter.RenderBeginTag(HtmlTextWriterTag.A); htmlTextWriter.Write(item.Title.Length == 0 ? item.Link : item.Title); htmlTextWriter.RenderEndTag(); htmlTextWriter.RenderBeginTag(HtmlTextWriterTag.Br); htmlTextWriter.RenderEndTag(); htmlTextWriter.Write(item.Description); htmlTextWriter.RenderEndTag(); firstItem = false; } htmlTextWriter.RenderEndTag(); htmlTextWriter.RenderEndTag(); } textWriter.Flush(); textWriter.Close(); BrowserCommon.OpenLink(fileName); MarkAllItemsAsRead(); }
private void HandleOpenFeedButtonClick(object sender, RoutedEventArgs e) { var feed = (Feed)FeedDataGrid.SelectedItem; BrowserCommon.OpenLink(feed.Source); }