internal void SaveToFeedSubscription(FeedSubscription fs)
        {
            fs.FeedUrl = urlTB.Text;
            fs.DisplayName = feedTitleTB.Text;
            fs.UpdateSeconds = int.Parse(updateMinutesTB.Text) * 60;
            fs.DaysToArchive = int.Parse(daysToArchiveTB.Text);
            fs.MaxItems = int.Parse(maxItemsTB.Text);

            if (defaultRB.Checked)
            {
                fs.FeedItemClickAction = FeedItemClickAction.Default;
            }
            else if (loadDescRB.Checked)
            {
                fs.FeedItemClickAction = FeedItemClickAction.LoadDescriptionInternalBrowser;
            }
            else if (loadLinkExtRB.Checked)
            {
                fs.FeedItemClickAction = FeedItemClickAction.LoadLinkExternalBrowser;
            }
            else if (loadLinkIntRB.Checked)
            {
                fs.FeedItemClickAction = FeedItemClickAction.LoadLinkInternalBrowser;
            }
            else
            {
                //this is a case that really shouldn't occur so set to default
                fs.FeedItemClickAction = FeedItemClickAction.LoadDescriptionInternalBrowser;
            }
        }
Ejemplo n.º 2
0
 public FeedItemsListManager(ListView lFeedItemsLV, Label lItemLinkLBL, Label lItemTitleLBL, ToolStripLabel lLastDownloadLBL,
     ToolStripButton lShowUnreadFirstBTN, ToolStripButton lMarkAllReadBTN, FeedSubTreeManager lFeedSubManager)
 {
     feedItemsLV = lFeedItemsLV;
     itemLinkLBL = lItemLinkLBL;
     itemTitleLBL = lItemTitleLBL;
     lastDownloadLBL = lLastDownloadLBL;
     showUnreadFirstBTN = lShowUnreadFirstBTN;
     markAllReadBTN = lMarkAllReadBTN;
     feedItemsNormalFont = feedItemsLV.Font;
     feedItemsBoldFont = new Font(feedItemsNormalFont, FontStyle.Bold);
     currentlyDisplayedFeedSubscription = null;
     feedSubManager = lFeedSubManager;
 }
 internal void LoadFromFeedSubscription(FeedSubscription fs)
 {
     urlTB.Text = fs.FeedUrl;
     feedTitleTB.Text = fs.DisplayName;
     updateMinutesTB.Text = (fs.UpdateSeconds / 60).ToString();
     daysToArchiveTB.Text = fs.DaysToArchive.ToString();
     maxItemsTB.Text = fs.MaxItems.ToString();
     switch (fs.FeedItemClickAction)
     {
         case FeedItemClickAction.Default:
             defaultRB.Checked = true;
             break;
         case FeedItemClickAction.LoadDescriptionInternalBrowser:
             loadDescRB.Checked = true;
             break;
         case FeedItemClickAction.LoadLinkExternalBrowser:
             loadLinkExtRB.Checked = true;
             break;
         case FeedItemClickAction.LoadLinkInternalBrowser:
             loadLinkIntRB.Checked = true;
             break;
     }
 }
Ejemplo n.º 4
0
        private void setNodePropertiesFromFeedSubscription(FeedSubscription fs, TreeNode node)
        {
            lock (feedsTreeView)
            {
                try
                {
                    if (feedsTreeView.InvokeRequired)
                    {
                        feedsTreeView.Invoke(new setFeedSubNodeTextDelegate(setFeedSubNodeText), new object[] { node, fs });

                    }
                    else
                    {
                        setFeedSubNodeText(node, fs);
                    }

                }
                catch (InvalidOperationException)
                {
                    //this was most likely caused by a feed reading thread returning during shutdown
                    //so we'll ignore it
            //					string x = e.ToString();
                }
            }
        }
Ejemplo n.º 5
0
        private void setFeedSubNodeText(TreeNode node, FeedSubscription fs)
        {
            string text;

            bool errorCapturedAsItem = false;

            if (fs.Feed.ReadSuccess == false && fs.Feed.ReadException != null)
            {
                //text = fs.DisplayName + "(" + fs.Feed.ReadException.ToString() + ")";
                FeedItem fi = new FeedItem();
                fi.Author = "BetterReader";
                fi.Description = string.Format("Error during read of feed: {0}", fs.Feed.ReadException);
                fi.DownloadDate = DateTime.Now;
                fi.HasBeenRead = false;
                fi.ParentFeed = fs.Feed;
                fi.PubDate = DateTime.Now;
                fi.Title = string.Format("Error reading feed: {0}", fs.Feed.ReadException.Message);
                fi.SetGuid();
                fs.Feed.FeedItems.AddOrUpdate(fi);
                errorCapturedAsItem = true;
            }

            if (fs.Feed.ReadSuccess || errorCapturedAsItem)
            {
                text = fs.ToString();
                if (fs.Feed.UnreadCount > 0)
                {
                    node.NodeFont = feedsBoldFont;
                }
                else
                {
                    node.NodeFont = feedsNormalFont;
                }

                if (fs.Feed.UnreadCount == 0 && hideReadFeedsBTN.Checked)
                {
                    //user has selected hideReadFeeds option and this feed has no unread items
                    feedsTreeView.HideNode(node);
                }
                else
                {
                    feedsTreeView.ShowNode(fs);
                }
            }
            else
            {
                //if (fs.Feed.ReadException != null)
                //{
                //    //text = fs.DisplayName + "(" + fs.Feed.ReadException.ToString() + ")";
                //    FeedItem fi = new FeedItem();
                //    fi.Author = "BetterReader";
                //    fi.Description = string.Format("Error during read of feed: {0}", fs.Feed.ReadException);
                //    fi.DownloadDate = DateTime.Now;
                //    fi.HasBeenRead = false;
                //    fi.ParentFeed = fs.Feed;
                //    fi.PubDate = DateTime.Now;
                //    fi.Title = string.Format("Error reading feed: {0}", fs.Feed.ReadException.Message);

                //}
                //else
                //{
                    text = "Loading . . .";
                //}
            }

            node.Text = text;
        }
Ejemplo n.º 6
0
 internal TreeNode UpdateNodeFromFeedSubscription(FeedSubscription fs)
 {
     TreeNode node = TreeNodesByTag[fs];
     setNodePropertiesFromFeedSubscription(fs, node);
     return node;
 }
Ejemplo n.º 7
0
        internal void AddFeedSubscriptionToFolder(FeedFolder parentFolder, FeedSubscription fs)
        {
            if (parentFolder == null)
            {
                fst.RootLevelNodes.Add(fs);
            }
            else
            {
                parentFolder.ChildNodes.Add(fs);
            }

            TreeNode newNode = new TreeNode(fs.ToString());
            newNode.Tag = fs;
            newNode.ImageIndex = 1;
            if (TreeNodesByTag != null && parentFolder != null && TreeNodesByTag.ContainsKey(parentFolder))
            {
                TreeNode parentNode = TreeNodesByTag[parentFolder];
                parentNode.Nodes.Add(newNode);
            }
            else
            {
                feedsTreeView.Nodes.Add(newNode);
            }

            if (TreeNodesByTag == null)
            {
                TreeNodesByTag = new Dictionary<object, TreeNode>();
            }
            TreeNodesByTag.Add(fs, newNode);
            SaveFeedSubTree();
        }
Ejemplo n.º 8
0
 private void showFeedSubPropertiesDialog(FeedSubscription fs)
 {
     SubscriptionPropertiesForm spf = new SubscriptionPropertiesForm(fs);
     if (spf.ShowDialog() == DialogResult.OK)
     {
         feedSubManager.SaveFeedSubTree();
         fs.Feed.FeedItems.PurgeOldItems();
         feedSubManager.UpdateNodeFromFeedSubscription(fs);
         //setNodePropertiesFromFeedSubscription(fs, feedSubManager.TreeNodesByTag[fs]);
         if (fs.Feed.ReadSuccess != true)
         {
             fs.BeginReadFeed(new FeedSubscriptionReadDelegate(feedSubReadCallback));
             fs.ResetUpdateTimer();
         }
     }
 }
Ejemplo n.º 9
0
 private void markFeedRead(FeedSubscription fs)
 {
     fs.MarkAllItemsRead();
     feedSubManager.UpdateNodeFromFeedSubscription(fs);
     if (feedItemsManager.CurrentlyDisplayedFeedSubscription == fs)
     {
         displayFeedItems(fs);
     }
     fs.ResetUpdateTimer();
 }
Ejemplo n.º 10
0
        private void feedSubReadCallback(FeedSubscription fs)
        {
            if (IsDisposed && Disposing == false)
            {
                return;
            }

            TreeNode node = feedSubManager.UpdateNodeFromFeedSubscription(fs);

            if (InvokeRequired)
            {
                feedsTV.Invoke(new displayFeedItemsIfSelectedDelegate(displayFeedItemsIfNodeSelected),
               new object[] { node, fs });
            }
            else
            {
                displayFeedItemsIfNodeSelected(node, fs);
            }

            if (fs.Feed.HasNewItemsFromLastRead && notifyIcon1.Visible)
            {
                //the app is minimized and new items were found so set the notifyIcon to alert status
                notifyIcon1.Icon = redLightIcon;
                notifyIcon1.Text = newUnreadItemsMessage;
            }
        }
Ejemplo n.º 11
0
 private void displayFeedItemsIfNodeSelected(TreeNode node, FeedSubscription fs)
 {
     if (node.IsSelected)
     {
         displayFeedItems(fs);
     }
 }
Ejemplo n.º 12
0
 private void displayFeedItems(FeedSubscription feedSubscription)
 {
     feedItemsManager.DisplayFeedItems(feedSubscription);
     clearWebBrowser();
     feedTitleLBL.Text = feedSubscription.DisplayName;
     feedTitleLBL.Width = splitContainer2.Panel1.Width;
 }
 public SubscriptionPropertiesForm(FeedSubscription lFs)
 {
     InitializeComponent();
     fs = lFs;
     feedSubscriptionPropertiesControl1.LoadFromFeedSubscription(fs);
 }
Ejemplo n.º 14
0
        public void DisplayFeedItems(FeedSubscription feedSubscription)
        {
            //lock (feedItemsLV)
            //{
            currentlyDisplayedFeedSubscription = feedSubscription;
            itemLinkLBL.Visible = false;
            itemTitleLBL.Visible = false;
            feedSubscription.ResetUpdateTimer();
            feedItemsLV.ListViewItemSorter = currentlyDisplayedFeedSubscription.ColumnSorter;
            showUnreadFirstBTN.Visible = true;
            showUnreadFirstBTN.Checked = currentlyDisplayedFeedSubscription.ColumnSorter.SmartSortEnabled;
            lastDownloadLBL.Visible = true;
            lastDownloadLBL.Text = "Last Downloaded: " + feedSubscription.Feed.LastDownloadAttempt.ToString();
            markAllReadBTN.Visible = true;

            listViewItemsByTag = new Dictionary<FeedItem, ListViewItem>();
            //feedItemsLV.BeginUpdate();
            feedItemsLV.Clear();
            if (feedSubscription.Feed.ReadSuccess || feedSubscription.Feed.ReadException != null)
            {
                BindFeedItemsToListView(feedSubscription.Feed.FeedItems);
                feedItemsLV.Enabled = true;
            }
            else
            {
                if (feedSubscription.Feed.ReadException == null)
                {
                    feedItemsLV.Columns.Add("Title");
                    ListViewItem lvi = new ListViewItem("Loading");
                    feedItemsLV.Items.Add(lvi);
                    feedItemsLV.Enabled = false;
                }
                //else
                //{
                //    feedItemsLV.Columns.Add("Error");
                //    ListViewItem lvi = new ListViewItem(feedSubscription.Feed.ReadException.ToString());
                //    feedItemsLV.Items.Add(lvi);
                //    feedItemsLV.Enabled = false;
                //}

                //feedItemsLV.EndUpdate();
                return;
            }
            feedItemsLV.Sort();

            clearColumnHeaderIcons();
            if (currentlyDisplayedFeedSubscription.ColumnSorter.SortColumn < feedItemsLV.Columns.Count)
            {
                feedItemsLV.Columns[currentlyDisplayedFeedSubscription.ColumnSorter.SortColumn].ImageIndex =
                        getArrowImageIndexForSortColumn(currentlyDisplayedFeedSubscription.ColumnSorter);
            }
            else
            {
                MessageBox.Show("A recoverable error has been encountered: The current sort column index (" +
                    currentlyDisplayedFeedSubscription.ColumnSorter.SortColumn.ToString() + ") is greater than " +
                    "the number of columns in the FeedItems ListView (" + feedItemsLV.Columns.Count.ToString() + ")");
            }
            //feedItemsLV.EndUpdate();
            //}
        }
Ejemplo n.º 15
0
 public static new FeedSubscription GetFromOpmlXmlNode(XmlNode node)
 {
     FeedSubscription fs = new FeedSubscription();
     fs.DisplayName = node.Attributes["text"].Value;
     fs.FeedUrl = node.Attributes["xmlUrl"].Value;
     return fs;
 }