For those people that attended Robert Garfoot’s TechEd Europe session on end to end development in WP7, here is the source code for his demos.
In order to run the demo code you will need VS2010, WP7 SDK, Azure SDK.
Running for the first time
Run VS2010 elevated (needed for Azure) and build the project. Run using the GadgetVote.Client and GadgetVote.Server projects as startup projects.
Once running you will need to go to settings in the client and change the address of the server to localhost:81 (or whatever port your Azure service is running on in DevFabric). You can also choose to use the proper WP7 push notifications service by leaving the check box ticked or use the Azure based stub service by unticking the box. You will need to restart the client app after changing this setting.
It’s a demo project!
It’s a demo project, it will crash and break if you don’t do things just right. If the Azure service hasn’t started by the time the phone app starts then you’ll get an exception from the client app. Just hit F5 and carry on, once the Azure services have started you can go to settings and hit OK and it should register again with the Azure service and work.
Who am I?
You will want to go to settings and add a username for yourself, this is name@domain, I usually use something like rob@emulator or rob@phone1 etc.
I do have friends, honest
Next you’ll need to hit the + button and add a friend, you can just add yourself for now, the name doesn’t matter but the second field must match the name entered in settings.
Adding a gadget
You can then add a gadget by clicking the camera. Check the table storage on your Azure instance though first, the clients must all have registered themselves with push notification endpoints before doing this or you’ll get a crash! You can goto settings and hit OK to force it to re-register.
You will need to run multiple machines to do this with an emulator on each. If you have phones then you can use those. Azure DevFabric only allows connections from the local machine though, to get around this I run a reverse proxy using IIS and the ARR plugin. Configure a proxy with a URL rewrite rule for something like /azure to map to localhost:81. Then you can use ip/azure for the host name in the client settings on the WP7 app and it’ll work remotely.
Usual caveats apply, this is demo code, it’ll explode if you prod it wrong and don’t use in production.
Original post by Robert Garfoot on 12th Novemeber 2010, here: http://garfoot.com/blog/2010/11/teched-gadgetvote-source-code/