Exemplo n.º 1
0
        private void TopicClicked(object sender, EventArgs e)
        {
            // Show all articles contained in the topic
            TopicTreeViewItem selectedTopic = (TopicTreeViewItem)sender;
            List <Article>    articles      = new List <Article>();

            foreach (TopicItem t in topics)
            {
                if (t.name == (string)selectedTopic.Header)
                {
                    articles = t.articleList;
                }
            }

            articleList.Items.Clear();


            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
            }
        }
Exemplo n.º 2
0
        private void AddToTreeView(TopicItem newTopic)
        {
            // Need to map the click functions for the newly added items
            TopicTreeViewItem newItem = new TopicTreeViewItem(newTopic.name);

            newItem.MouseLeftButtonUp += TopicClicked;
            treeView.Items.Add(newItem);
        }