Exemple #1
0
 public async static Task ParseJson(string token)
 {
     using (HttpClient httpClient = new HttpClient())
     {
         string address = $"http://api.openweathermap.org/data/2.5/weather?q=Moscow&appid={token}&units=metric&lang=ru&mode=json";
         Owm    owm     = Owm.FromJson(await httpClient.GetStringAsync(address));
         Console.WriteLine($"temperature {owm.Main.Temp} min {owm.Main.TempMin} max {owm.Main.TempMax}\nhumidity {owm.Main.Humidity}%\npressure {Math.Round(owm.Main.Pressure/0.75006375541921)}mmHg");
     }
 }
Exemple #2
0
 public static string ToJson(this Owm self) => JsonConvert.SerializeObject(self, Current.Converter.Settings);