public void GetMovieAsync(int id) { Movie m = new Movie(); EventHandler<EventArgs> f = null; f = (s, ea) => { m.GetMovieCompleted -= f; OnGetMovieCompleted(m); }; m.GetMovieCompleted += f; m.GetMovieAsync(id); }
protected virtual void OnGetMovieCompleted(Movie m) { if (GetMovieCompleted != null) GetMovieCompleted(this, new ResultEventArgs<Movie>(m)); }
void rt_GetMovieCompleted(object sender, ResultEventArgs<Movie> e) { movie = e.Result; titleTextBlock.Text = movie.Title; yearTextBlock.Text = movie.Year.ToString(); posterImage.Source = new BitmapImage(new Uri(movie.Posters.Original, UriKind.Absolute)); }