Goals:

Explanation:

Steps:

  1. Create a new Windows Forms Application project in Visual Studio.
  2. Add to the main form all necessary controls:
  3. Add an event handler for the click event of the getToolStripButton control:
    private XDocument xml;

    private
    void getToolStripButton_Click(object sender, EventArgs e)
    {
        
    string address = addressToolStripTextBox.Text.Trim();
        
    if (address.Length == 0)
        {
            
    MessageBox.Show("No address");
        }
        
    else
        {
            xml =
    null;
            
    try
            {
                xml =
    XDocument.Load(address);
            }
            
    catch (Exception ex)
            {
                
    MessageBox.Show("Exception loading feeds: " + ex.ToString());
            }
        }

        ShowFeeds();
    }
  4. In response for the changing selection on the list of items, show properties of the selected item and its description:
    private void ShowItemProperties(XElement item)
    {
        
    if (item == null)
        {
            feedAuthorLabel.Text =
    "";
            feedLinkLabel.Text =
    "";
            feedPublishedLabel.Text =
    "";
            feedTitleLabel.Text =
    "";
        }
        
    else
        {
            feedAuthorLabel.Text = GetSaveValue(item,
    "author");
            feedLinkLabel.Text = GetSaveValue(item,
    "link");
            feedPublishedLabel.Text = GetSaveValue(item,
    "pubDate");
            feedTitleLabel.Text = GetSaveValue(item,
    "title");
        }
    }

    private void ShowItemDescription(XElement item)
    {
        if (item == null)
        {
            descriptionWebBrowser.DocumentText = "";
        }
        else
        {
            descriptionWebBrowser.DocumentText = item.Element("description").Value;
        }
    }
    private void ShowItem(XElement item)
    {
        try
        {
            ShowItemProperties(item);
            ShowItemDescription(item);
        }
        
    catch (Exception ex)
        {
            MessageBox.Show("Exception parsing feeds: " + ex.ToString());
        }
    }

    private void itemsListView_SelectedIndexChanged(object sender, EventArgs e)
    {
        
    if (itemsListView.SelectedIndices.Count == 1)
        {
            
    ListViewItem lvi = itemsListView.SelectedItems[0];
            
    XElement item = lvi.Tag as XElement;
            ShowItem(item);
        }
    }
  5. To make the LinkLabel control opening a browser with a target address, custom code must be provided (the LinkLable control provides appearance, but not functionality):
    private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
    {
        
    string url = (sender as LinkLabel).Text;
        
    Process.Start(url);
    }
  6. Run and test the application.
    Note that we have a built-in web browser.
  7. There is one thing in out application that should be improved. When there is a problem with connection to the source of feeds, or just the connection is slow and the content is big, our application freezes. The reason is downloading data from the Internet in the main thread. It should never be done in this way - always use asynchronous methods for loading data from the Internet or use a background thread. There is no asynchronous equivalent of the XDocument.Load method, so we have to create a background thread. To force the user to wait, we will display a modal form with nice 'waiting' animation.
    Add a new form (named WaitingForm) to the project. Add controls to the form:
  8. Run and enjoy the great RSS Reader:
  9. All collections of XML data can be used by LINQ expressions. As an example lets define a task: find the most frequent word from descriptions of all items from the channel.

[Source code]