This project has moved and is read-only. For the latest updates, please go here.

Need help with async requests..

Topics: Developer Forum
Jan 12, 2011 at 6:37 PM

Been using your library for a long time and love it but am lost when it comes to async requests in general.. Do you have an example? Would love to see one using interestingnessgetlistasync if possible. Thank you for your wonderful work



Jan 18, 2011 at 10:48 AM

Async methods go something like this:

Flickr f = new Flickr(ApiKey, SharedSecret, AuthToken);

f.PhotosetsGetListAsync(r =>
      if (r.HasError)
          // check r.Error to see what the error is.
         // r.Result is the actual result.
         PhotosetCollection photosets = r.Result;

r is an FlickrResult<T> where T will be the actual result for whatever you are calling (in this instance FlickrResult<PhotosetCollection>).

If you didn't want to use lambda expressions you could create a method that took the FlickrResult<T> as an argument like so:

private void PhotosetGetListCallback(FlickrResult<PhotosetCollection> r)
  // check r.Error and r.Result in here.

// and then call as follows:

var action = new Action<FlickrResult<PhotosetCollection>>(PhotosetGetListCallback);


Sorry for the delay in replying. Hope that helps.


May 1, 2012 at 1:00 AM

Hi.. sorry to barge in here but it's kind of related... is there a way to cancel an async request once it has fired off... for example, you have a bunch of async calls to get supporting information on a photo when being displayed, but then you click to the next photo... seems to hang until all the calls have returned, then goes to the next photo....  just curious..

May 1, 2012 at 11:20 AM

There isn't an way to cancel a request unfortunately. No call should really be taking more than a few milliseconds.

I don't understand why it is hanging and waiting for all calls to return - this is kinda of the opposite I would expect to see for asynchronous calls. perhaps you could show us some of your code and we might be able to help.