Flickr Uploader for Windows Phone 7

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:

Peaceful Night

Last monday our Virgin Media connection went down. We lost our TV and
the internet (but phone was still working, somehow).

Now you might think – bloody disgusting, but I’m actually thankful.
Instead of sitting, face glued to a screen (TV or monitor) I put some
music on (Sign No More by Mumford and Sons for those interested) and
sat and read a book. Then I went to bed early and had a great nights
sleep in my brand new foam mattress, that also helped me sleep well, and I got it at a mattress sale blackfriday. And so far, so good.

I think I needed that.

Posted via email from Sam’s Random Junk!

Reasons Twitter is a better IM client…

I'm starting to like twitter. As with most (damn the phrase) web 2.0 major sites I have an account (I'm there on all the social networks, flickr, pownce, last.fm, friendfeed etc) but I found it quite hard work to get used to the format.

Then I started trying out http://www.posterous.com which takes anything I email them (like this), throws it on a blog and then updates twitter. That and a couple of people who've sent me actual tweets (ok, that still sounds silly) and the service just comes alive.

And the reasons I prefer it over normal IM – well mainly because of the whole "who's online" thing – I hate being pinged in IM by people at random times – if maybe I just logged on to check one thing in google, or I'm trying to write some code or play a game. So what do I do, well I shut down the IM client – or even worse make sure it doesn't start at startup. And from there on in it becomes pointless.

With Twitter there is no concept of being online – you just post anytime you want – and read others posts anytime you want. You can keep track of those sent to your ears, as well as what the world is saying (I think Search was the big thing missing, but now they've got that sorted too).

And if you close your twitter client (or heaven forbid twitter is down) then that's just a while for you to get more work done :)

Posted by email from Sam’s posterous

Amen Corner – My Photo in Print

I’m pleased to announce that a photo I took a few years back was chosed to be the CD cover of american blue-grass band Railroad Earth (no, I hadn’t heard of them either). You can listen to most of the album on their web site if you want.

I’ve just received the pre-release CD and it’s great to see myself in print (and my name on the inside cover as well!)

Here’s a of shots of the finished work alongside the original:

Update: On the origins of my photo – I took the photo in Dec 2006. We actually have a street (or maybe its just the corner) called Amen Corner – it runs behind St Nicholas Cathedral in Newcastle (England).

The photo was taken during a winter festival called the Glow Festival that was run by the council – various light based art installations throughout Newcastle and Gateshead. This particular lamp had had its bulb changed to a red light – hence the colours in the photo.

I believe one of the band members found the photo on Flickr (see above link tot he original page) and suggested it to the rest of the band – and the rest as they say is history :)

How to use ECHO to output a blank line

I learnt something new today. You can use the DOS ‘ECHO’ command to output a line (or in fact any text you want) by putting a period ‘.’ immediately after the ECHO. i.e. The following will echo a blank line.

C:> ECHO.

Also, if you want to echo some special characters you can put a carat ‘^’ before them:

C:> ECHO ^>^>^>

>>>

C:> ECHO >>>

> was unexpected at this time.

Read the comments on the following post to get more juicy tips:

The Old New Thing : How do I force the ECHO command to echo?

20 things I’m longing to do in 2008 (Part One)

Tagged by Brenda, so…

I shall start at 1 and see how far I get – so in no particular order:

1. Convert my Flickr Screensaver to WPF.

I thought I’d start off with this as this is a mostly code related blog. I’ve written some small prototypes and it looks like it could be quite good. I’ll also try and write a couple of blog posts about the process/what I learnt.

2. Take more photos.

I had a slow end to the year photo-wise, but I got a new wide angle lens for Christmas which it would be rude not to use, plus strange people keep giving me rolls of film, so they need experimenting with.

3. Lose weight and strengthen ‘core’.

I’ve been hovering at around the 13stone mark for quite a while now. I want to get down to 12.5-ish, all in an aid to…

4. Improve my climbing.

Climbing is now definitely my main none-work related focus at the moment, and my main inspiration for getting the weight down. We have three trips abroad planned for this year, all climbing trips (Fontainebleau in France is the first one). Its a strange game, climbing – while there is a certain joy in ‘just climbing’ there is also a large part of you that always wants to be a little bit better.

Working on your ‘core stability’ (which is more than just your abs, but your back and other areas too) is very good for climbing. Good exercises include doing crunches on a swiss ball, planks (or benches as they are sometimes called) and super man exercises.

5. Visit more places in the north-east.

This one should go nicely with the No 2. Places I want to go this year include Dunstanburgh Castle and Cragside, but there are plenty of other places out there (like the Farne Islans for example).

6. Visit more places in the UK.

This one will go nicely with the climbing one as well. So far I’ve only really ever climbed a little in the Peak District, quite a bit in the Lake District, and lots in Northumberland. Possible places to go include definitely North Wales, other bits of Yorkshire, and ideally (though less likely) somewhere on the south coast, like Cornwall (there is an area called ‘Chair Ladder’ which has some amazing climbing on it).

7. Spell better

Get it into my head that the middle vowel of ‘definitely’ is an ‘i’, not an ‘e’ or an ‘a’. Whenever my hands spell that damn word I always get it wrong. Oh, and win more games of Scrabulous in the process.

8. Improve as a husband…

Hey, no-one said I’m perfect, so there’s always room for improvement. Luckily I have a wife who loves me (and who likes climbing too).

9. Think of something else to put on this list to make 10.

Because 9 just seems to few :)