Пример #1
0
 void fillLables(WeatherInfo.root output)
 {
     lbl_cityname.Text = string.Format("{0} {1}", output.name, output.sys.country);
     lbl_units.Text    = "\u00B0C";
     lbl_temp.Text     = string.Format("{0}", output.main.temp);
     lbl_humidity.Text = string.Format("{0}%", output.main.humidity);
     lbl_wind.Text     = string.Format("{0} м/с", output.wind.speed);
 }
Пример #2
0
 void createQuery(string url)
 {
     using (WebClient web = new WebClient())
     {
         try
         {
             var json   = web.DownloadString(url);
             var result = JsonConvert.DeserializeObject <WeatherInfo.root>(json);
             WeatherInfo.root output = result;
             fillLables(output);
         }
         catch (WebException e) {
             lbl_cityname.Text = e.Message;
         }
     }
 }