Esempio n. 1
0
        private void treeComp_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            articleList.Items.Clear();
            ComponentTreeViewItem senderComp = (ComponentTreeViewItem)sender;  // Typecast so we can figure out the sender
            List <Article>        articles;                                    // Create a new list of articles for the return

            articles = compView.Get_Articles_Under(senderComp.Path);           // Get the list of articles below the current selection

            foreach (Article i in articles)
            {
                ArticleListItem articleListItem = new ArticleListItem();        // Create a new ArticleListItem to be displayed
                articleListItem.Title       = i.Title;                          // Get the correct title
                articleListItem.Date        = i.Publication_Date;               // Get the correct date
                articleListItem.URL         = i.URL;
                articleListItem.Description = i.Summary;
                articleListItem.Read        = "";                               // Setting default to unread

                articleList.Items.Add(articleListItem);                         // Place in the UI
            }
        }
Esempio n. 2
0
        private void TopicButton_Click(object sender, EventArgs e)
        {
            // Add new topic
            string         newTopicName     = topicBox.Text;
            List <Article> allArticles      = compView.Get_Articles_Under("/");
            List <Article> topicArticleList = new List <Article>();

            foreach (Article a in allArticles)
            {
                if (a.Title.Contains(newTopicName) || a.Summary.Contains(newTopicName))
                {
                    topicArticleList.Add(a);
                }
            }
            // Need to have some catch for a topic that doesn't contain any articles
            TopicItem newTopic = new TopicItem(newTopicName, topicArticleList);

            this.topics.Add(newTopic);
            AddToTreeView(newTopic);
            topicBox.Clear();
        }