Skip to content

Instantly share code, notes, and snippets.

@bhameyie
Last active December 17, 2015 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhameyie/5663784 to your computer and use it in GitHub Desktop.
Save bhameyie/5663784 to your computer and use it in GitHub Desktop.
using RestSharp and imdbapi.com to get movie data
public class Finder
{
RestClient client = new RestClient("http://www.imdbapi.com/");
public delegate void FindingMovie(string content);
public event FindingMovie OnMovieFound;
public void FindMovie(string title)
{
var request = new RestRequest(string.Format("?i=&t={0}&plot=full", title),Method.GET);
request.RequestFormat = DataFormat.Json;
client.ExecuteAsync<Movie>(request, Callback());
}
private Action<RestResponse<Movie>> Callback()
{
return (e) => OnMovieFound(e.Content);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment