read

I was literally thinking about what should be my first WPF app. As Pete Brown said in one of his articles you need to find a good starting app to get familiar with the technology. First I wanted to create an old (undone) app of mine made in WinForms, but it was a bit to complicated for WinForms also so I decide to go with a RSS feed reader.

Started Googleing for some demo apps to illustrate how to start with this kind of app but didn’t find anything that I liked.

After that I searched how to read RSS feed. I found that you can load the feed into an XDocument (System.Xml.Linq.XDocument) and get your info from there if you know how to work with xml files. The problem was that not all feeds have the same format. ‘Great!’ I thought another app goes to the dustbin, but I didn’t want to give up that easily and found out that .NET has a special namespace that can handle Syndication feeds like RSS and Atom: System.ServiceModel.Syndication. In this namespace I found the SyndicationFeed class and from there I can use it to read the feed. Great stuff!

After all of this I started to think how the hell I’m going to store my feeds. After a great amount of thinking I found out that storing them into the App Settings was the best way to do it. One more problem solved. Another problem comes up. I need to store both the feed title and the feed address for later use. Great another problem arose. Started to store the feed title and the feed address into the same setting and them split them using the String.Split method but that proved ineffective for the following reason: I used ‘_’ (underscore) as the split char, but that isn’t recommended because what happens when the feed title or the feed address contains an underscore. I would’ve got an IndexOutOfRange at best or worse incorrectly formatted strings in my settings.

How to solve this issue? Simple: put the title and the address on two separate settings and then use the StringCollection (System.Collections.Specialized) class’s IndexOf method to get the index of the title and them retrieve the address at the same index (as you add the feed title and feed address at the same time in the settings, you wont get mix-up indexes). After solving all of these issues is time to figure out how to populate the feed list, get the feeds and display them somewhere. I’m at this stage of development. Multi-threading will be involved as it takes some time to get the feed from the web. Error-handling will be somewhat painful but who said that this kind of app will be easy?

As I get a working alpha of my app I’ll post it on Google Project or Codeplex or maybe both and get some user feedback.

Here are some previews:

image UI mock-up (will be restyled)

image Code so far…

image Code so far… II

Looking forward for some feedback.

Blog Logo

Robert Iagar


Published

comments powered by Disqus
Image

Robert's Blog

Software Engineer. .NET Developer. Amateur Photographer. Drum & Bass DJ. Welcome to my blog!

Back to Overview