/// <summary> /// Updates/Retrieves a yts response and displays the data. /// </summary> private async Task updateYtsMoviesAsync() { // Written, 21.09.2020 this.ytsSearchParameters_groupBox.Enabled = false; this.preUpdateLists(this.ytsMovieResults_listView); this.ytsSearchResults_groupBox.Text = "Search results"; Response <MovieListInfo> response = await YTSManager.retrieveMovieListAsync(this.ytsControlsToParameters()); ListViewItem[] items = new ListViewItem[response.data.movies?.Length ?? 0]; if (response.data.movies != null) { this.ytsSearchResults_groupBox.Text = String.Format("Search results {0}/{1} | ({2} pages)", response.data.movies.Length * response.data.page_number, response.data.movie_count, response.data.movie_count / response.data.limit); for (int i = 0; i < response.data.movies.Length; i++) { MovieInfo info = response.data.movies[i]; string[] subItems = new string[] { info.title, info.description_full, info.year.ToString(), info.runtime + "mins", }; items[i] = new ListViewItem(subItems) { Tag = info.toTmdbMovie() }; } } this.postUpdateLists(this.ytsMovieResults_listView, items); this.ytsSearchParameters_groupBox.Enabled = true; }