예제 #1
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     using (HttpClient client = new HttpClient())
     {
         var response = client.GetAsync(@"https://got-quotes.herokuapp.com/quotes").Result;
         if (response.IsSuccessStatusCode)
         {
             var         content = response.Content.ReadAsStringAsync().Result;
             HerokuQuote q       = JsonConvert.DeserializeObject <HerokuQuote>(content); //calling the class
             quote.Inlines.Add(new Italic(new Run("italic")));
         }
     }
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //https://got-quotes.herokuapp.com/quotes

            using (HttpClient client = new HttpClient())
            {
                var response = client.GetAsync(@"https://got-quotes.herokuapp.com/quotes").Result;
                if (response.IsSuccessStatusCode)
                {
                    var         content = response.Content.ReadAsStringAsync().Result;
                    HerokuQuote q       = JsonConvert.DeserializeObject <HerokuQuote>(content);

                    var x = JsonConvert.SerializeObject(q);
                }
            }
        }