/// <summary> /// Returns first available fan art as BitmapImage /// </summary> /// <param name="id">TVDb ID of Series</param> /// <returns></returns> public async static Task <BitmapImage> GetFanArt(int id) { string path = db + id + "\\Fanart\\Fanart.png"; if (!File.Exists(path)) { await Task.Run(() => { Poster fanart = Poster.GetFanArt(id); if (!String.IsNullOrEmpty(fanart.fileName)) { WebClient wc = new WebClient(); Directory.CreateDirectory(Path.GetDirectoryName(path)); wc.DownloadFile("https://www.thetvdb.com/banners/" + fanart.fileName, path); } }); } if (File.Exists(path)) { return(await LoadImage(path)); } return(null); }