public override Photo[] GetPhotoUrl()
        {
            BingData data = DeserializeData <BingData>(GetAPIData(URL));

            return(data.images.Select(x =>
            {
                BitmapImage image = new BitmapImage(new Uri(("http://www.bing.com" + x.url)));
                return new Photo()
                {
                    URL = "http://www.bing.com" + x.url,
                    Metadata = new List <PhotoMetadata>()
                    {
                        new PhotoMetadata()
                        {
                            Title = "Title",
                            Description = x.title
                        },
                        new PhotoMetadata()
                        {
                            Title = "Copyright",
                            Description = x.copyright
                        },
                        new PhotoMetadata()
                        {
                            Title = "URL",
                            Description = "http://www.bing.com" + x.url
                        }
                    }
                };
            }).ToArray());
        }
Beispiel #2
0
        private BingData InitializeBingDataFromWebApi()
        {
            using (WebClient client = new WebClient())
            {
                string   jsonData = client.DownloadString(url);
                BingData bd       = JsonConvert.DeserializeObject <BingData>(jsonData);

                foreach (BingImage image in bd.images)
                {
                    image.url = url_begin + image.url;
                }

                return(bd);
            }
        }