The art of Windows Phone

Menu

Making a Windows Phone weather app in an hour

I did a couple of talks – one of which was an hour-long session where I guided the attendees through the process of creating a good-looking weather app for Windows Phone. There are no shortage of weather apps in the marketplace, but it was a nice example to bring in a lot of different real-world situations like consuming JSON, using MVVM, and lots of binding stuff.

The point was to show how easy it is to create an app quickly. It only took 20 lines of code and 60 lines of XAML (half of which are closing tags so don’t count). The app would take around 15 minutes to make if I weren’t explaining.

After the session a number of people asked me if I would post-record the talk and upload it. So below is the full source code, along with the talk which I uploaded to YouTube.

A few things to note:

I’m still tired from TechEd, so I do lose my train of thought every now and then 😉 (but I did manage to record the whole video first time and in one go!)

I kept the talk the same as the one I did for them, which means that it does not go vastly into detail about every topic (not enough time).

Because of time, there are many things missing. The obvious one is that the location is hard-coded in. But there are smaller problems like the light-theme not being supported properly.

There isn’t really any error handling.

If there is interest I will flesh-out the solution a bit to make it a marketplace-worthy app and post the source of that.

Loved this tutorial. I am a new to windows phone Wanted to Grab the user’s current location is it ideal to do that in the viewmodel and ask for permisson after applicaton initialization

RogueCode

I would recommend defaulting to somewhere like New York, and then asking for permission. Only after they give permission, then get their location.
But yes, stick that all in the ViewModel (except maybe the prompts – depending on how strictly you want to follow MVVM).