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:
Hi,
Unfortunately it doesn’t work on my LG. The first issue is that I cannot choose any picture (the screen is empty, no integration in my existing picture library) or take a new picture.
The second issue is with authentication: Even though I couldn’t choose a picture and got an error when I tried to navigate further, the navigation occured so I gave it a try and logged in into Flickr. This worked but the next step showed “Invalid frob (108)” in a message box. Of course, this is maybe because no picture was selected in the first place ;)
Where did you test, on a device or an emulator only, and what build did you use?
Thanks,
Laurent
Apologies. I think there is an issue with the files I uploaded. I will update them to a working version later.
I don’t have a device myself, but I will upload the version that has been tested on a real device.
Great one…. Thanks… This is what exactly i am searching for !!! Thanks a ton