In learning Silverlight 2 I needed some self imposed tasks, one such task was to build a simple Flickr image browser, among other things. In doing so as most people would I found a .net Flicker API called FlickrNet. However when you try to add a reference to FlickrNet from my Silverlight 2 project I encountered a few issues with projects not loading. However after some research and hacking I was able to . Converting the project was the easy part but it was going to be just too hard to get the entire library working because of its reliance on a lot of calls to methods that are not available in the Silverlight Core CLR.

Therefore I have had to strip the existing FlickrNet functionality down, I have decided to christen it Flickrlight and now have a simple working demo of the Flickr Browser Application.

Flickrlight Demo

  The code is fairly similar to what FlickrNet, for those of you who are familiar with the existing API.

   1: private void btnGetPhoto_Click(object sender, RoutedEventArgs e)
   2: {
   3:     PhotoSearchOptions pso = new PhotoSearchOptions();
   4:     pso.Tags = feedURL.Text;
   5:     Photo p = new Photo();
   6:     p.ApiKey = ApiKey;
   7:     p.Secret = SharedSecret;
   8:     p.OnResponseCompleted += p_OnResponseCompleted;
   9:     p.BeginPhotosSearch(pso);
  10: }

One of the few changes is that the calls being made are Asynchronous and hence require the subscription to the Completed Event.

   1: private void p_OnResponseCompleted(FlickrResponseRecievedCompleteEventArgs<FlickrBase> e)
   2: {
   3:     Action bindToList = () => imageList.ItemsSource = ((Photos)e.ResultValue).PhotoCollection;
   4:     this.Dispatcher.BeginInvoke(bindToList);
   5: }

 

At this stage all I have done was to begin to move the Search for Photos functionality, however over the next few weeks I will move some more of this functionality across. I will also make Flickrlight available on Codeplex (unless someone tells me otherwise). Seeing as this will be my first foray into the world of open source if anyone has any experience with what I should be doing here, your help will be greatly appreciated.

Share/Save/Bookmark

, , ,
Trackback

4 comments untill now

  1. [...] my last post about Flickrlight I mentioned creating a simple Flickr Image Browser in Silverlight. Feedback is required please. [...]

  2. Where is the code for it??

  3. Did you updated it to Silverlight 2.0 already?

  4. Tom Giammarresi @ 2008-11-25 06:01

    I’m interested in this functionality.
    When will the code be available?
    I would like to be able to get the photos for a specific user.

    Thanks
    Tom

Add your comment now