protected override void OnCreate(Bundle bundle) { this.Title = "Now Playing Movies"; base.OnCreate(bundle); string type = Intent.GetStringExtra("Type"); var api = new Tmdb("e7ea08e0ed9aba51ea90d5ffe68fa672"); var layout = new RelativeLayout(this); var progressBar = new ProgressBar(this, null, Android.Resource.Attribute.ProgressBarStyleSmall); layout.AddView(progressBar); SetContentView(layout); ThreadPool.QueueUserWorkItem(delegate { var result = api.GetNowPlayingMovies(1); var names = result.results.Select(r => r.title).ToList(); RunOnUiThread(delegate { var listView = new ListView(this); listView.Adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, names); progressBar.Visibility = ViewStates.Invisible; layout.AddView(listView); layout.RemoveView(progressBar); }); }); }
public void GetNowPlayingMovies() { var result = api.GetNowPlayingMovies(1); Assert.Greater(result.results.Count, 1); foreach (var movie in result.results) { Console.WriteLine(movie.title + " - " + movie.id + " - " + movie.poster_path + " - " + movie.release_date); } }
public TmdbNowPlaying GetNowPlayingMovies(int page) { var api = new Tmdb(App.ApiKey, null); TmdbNowPlaying result = null; api.GetNowPlayingMovies(page, null, tmdbResult => { result = tmdbResult.Data; _autoResetEvent.Set(); }); _autoResetEvent.WaitOne(); return(result); }