I’ve put together a basic photo uploader for the new Windows Phone 7. This was a good exercise for me as I had to a) make sure that the Flickr.Net library worked correctly in Windows Phone 7, and b) finally learn Silverlight, at least the basics anyway.
Well I had great fun, and I’m finally ready to share. You can download the files below.
Things I Learnt
There are a few things I learnt while doing this about the way to make great Windows Phone 7 apps, so I thought I would share.
Custom Navigation
One thing that was an interesting challenge was trying to make the authentication process work easily. Basically there are 3 pages to the app – the photo chooser, the authentication page, and the upload page.
If you have already authenticated then it skips the authentication page.
If you authenticate and then go to the upload page I didn’t want to back button to bring you back to the authenticate page again, I wanted to skip it. This is with the following code:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
if (!String.IsNullOrEmpty(SettingsHelper.AuthenticationToken) && NavigationContext.QueryString.Count == 0)
{
if (NavigationService.CanGoBack)
NavigationService.GoBack();
}base.OnNavigatedTo(e);
}
Basically if you have already stored the authentication token then continue to move back if you can. I added in a check on the querystring in case you ever wanted to ‘redo’ authentication (this hasn’t been implemented yet).
Download Files
Here are the source files and the XAP file to download: