예제 #1
0
        /// <summary>Looks up known media identifier asynchronous.</summary>
        /// <param name="idForMedia">The identifier for media.</param>
        /// <returns></returns>
        protected virtual async Task <Movie> LookUpKnownMediaIdAsync(int idForMedia)
        {
            var tmdbApi = new TMDBApi();

            if (idForMedia > -1)
            {
                var response = await tmdbApi.LookUpIdForMovieAsync(idForMedia).ConfigureAwait(false);

                return(response);
            }

            // Illegal media was inserted
            return(null);
        }
예제 #2
0
        private async Task <List <Result> > Response(string titleToSearchFor)
        {
            try
            {
                var tmdbApi  = new TMDBApi();
                var response = await tmdbApi.SearchForMovieAsync(titleToSearchFor)
                               .ConfigureAwait(true);

                //Search returned no matches
                if (response != null)
                {
                    return(response);
                }
            }
            catch (HttpRequestException)
            {
                // Connection was down?
                //Console.WriteLine(e);
            }

            return(null);
        }