예제 #1
0
        private async Task UpdateAPOD()
        {
            APODRetriever  apodRetriever = new APODRetriever();
            APODRootObject apodRoot      = await apodRetriever.GetAPOD();

            ViewModel.ImageUrl = apodRoot.url;
            credit.Text        = apodRoot.url;
            explain.Text       = apodRoot.explanation;
            title.Text         = apodRoot.title;
        }
예제 #2
0
        public async Task <APODRootObject> GetAPOD()
        {
            HttpClient httpClient = new HttpClient();


            string api      = $"https://api.nasa.gov/planetary/apod?api_key=b6OIAb4HbQ1MaLlblj2OSNBOeUCGcmtw2FsKemJW";
            string response = await httpClient.GetStringAsync(api);

            APODRootObject apod = JsonConvert.DeserializeObject <APODRootObject>(response);


            return(apod);
        }