In the summer 2012, the WinSource website held a contest among the Windows Phone developers to create an official application for their website.
I was a participant in the contest and I can tell you that it was a really interesting and challenging contest. My application finished in third position.
You can download the application from the winner at here.
Before I decided to put the full source code of my complete application. I asked the owners of the WinSource from the Neverstill company if I can publish the source code of my application. They accepted my idea, because it is a great way to help the Windows Phone community.
In the current form, the application has enough features that it can be an alternate WinSource application. The only restriction is a user cannot publish or use the WinSource’s logo, the assets or the content from the WinSource. NOTE, this project is licensed under a slightly modified MIT license which reflects the above restriction.
The purpose of having this open project is to help the community creating a professional news reader for any other websites that give the permissions. It also shows different concepts which can be applied in different type of applications.
My application contains the following features:
- The metro design is used throughout the app, while the main page is showcased using the panorama design.
- Fast navigation between pages.
- Articles classified by date.
- Play YouTube videos.
- A description of each team member, including a display of the author name & image on each author’s page. Also included is the option to send the author an email.
- Article links can be shared on Twitter, Windows Live, Facebook, or by email.
- The application bar contains shortcuts to the Facebook page and the Twitter page of the website.
- The About page provides a way to send an email and to write a review of the app.
- Option to automatically refresh articles when the application launches.
The following list contains advanced features:
- Offline mode. Articles can be read even when no internet connection is available.
- Unlimited space for saving articles, which can then be accessed using the Saved Articles page.
- Articles can be periodically downloaded (every ~4 hours) in the background, even when the app is not running. This feature does not require server support.
- Toast notification will display the number of new articles available, and a badge count in the application live tile will also display this number.
- The back of the live tile will display the latest article title.
Open source libraries
I used three open source libraries that are well known in the developer community:
- GalaSoft MvvmLight (http://mvvmlight.codeplex.com/): Used to architecture a modular application and to easily add future features.
- Newtonsoft.Json (http://json.codeplex.com/): Used to save and love articles for the offline mode.
- Silverlight Toolkit (http://silverlight.codeplex.com/): Used for hub tile control and for the optimized list control.
I use the Model View-Model View (MVVM) pattern in my solution. The solution is separated in five assemblies:
- DotNetApp.Toolkit: It includes utility classes that can be reused in any Windows Phone projects. There is also my Request class that helps calling web resources.
- WinSource: This is the main project that includes the views, the data service, the view models and many more things.
- WinSource.Agent: It is the project that includes the schedule background service which permits to periodically download articles in the background.
- WinSource.Client: It contains all the web requests.
- WinSource.Model: It contains only the data structure.
You won’t find a lot of comment in my code, but I’m an heavy user on code convention and I tend use write small methods so the code should be self-explanatory.
How to build the application
All the required files are built-in in the solution. Make sure that the selected project is “WinSource” then press F5 to launch the application.
- The application has been tested with the Windows Phone SDK 7.1.
Future of the application
The application in its current form contains more features then some published news applications in the Windows Phone Store. That’s been said, the application is in a release state. As all software, it is always possible to polish and add features. You are welcome to add and suggest features.
What can you do with the source files of the application?
Simple answer: create your own news application! The source files provided are the best starting point to get your news application ready. The mechanism is ready and your tasks are:
- Replace the assets in the Assets folder of the WinSource assembly.
- Modify the classes in the WinSource.Client assembly in order to fetch the article descriptions and videos from your news source.
- Remove or add sections in the Panorama.
Also, if you read the code you can learn a lot about the Windows Phone SDK and about some best practices. The application is more complete than the ones in the MSDN samples.
You can contribute directly to the project on the Nokia developer website or you can download the source code.