public async Task <Image> GetLogo(int companyID, TmdbWrapper.Utilities.LogoSize logoSize, String logoPath = null) { Image x = null; if (logoPath == null && HasLogo == true) { //LogoPath can be null and going out and trying to get it doesn't do anything but add useless time! //TODO - need to do something about the time it takes to get Company info over and over.. TmdbWrapper.Companies.Company c = await TheMovieDb.GetCompanyAsync(companyID); // TMDB Company ID logoPath = c.LogoPath; } if (logoPath != null) { String cachePath = PrivateData.GetAppPath() + @"\Cache\Images\production\" + logoPath.Replace("/", ""); if (File.Exists(cachePath)) { x = Image.FromFile(cachePath); } else { Directory.CreateDirectory(Path.GetDirectoryName(cachePath)); // Insure Directory Exists Uri uri = Uri(logoSize); var wc = new WebClient(); x = Image.FromStream(wc.OpenRead(uri)); x.Save(cachePath); // This should be a separate non-blocking Task } } return(x); }
public async Task <Image> GetLogo(TmdbWrapper.Utilities.LogoSize logoSize) { return(await GetLogo(Id, logoSize, this.LogoPath)); }