private async void button2_Click(object sender, EventArgs e) { var response = await GetWheather(save.Coordinates); var orai = DarkSky.FromJson(response); label_temp.Text = orai.Currently.Temperature.ToString() + "°C"; pictureBox1.Image = UpdateIcon(orai.Currently.Icon); pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; //dataGridView1.DataSource = orai.Hourly.Data; System.DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); foreach (var item in orai.Hourly.Data) { dataGridView1.Rows.Add(dateTime.AddSeconds(item.Time).ToString(), item.PrecipIntensity.ToString(), item.Temperature.ToString(), item.CloudCover.ToString(), item.WindSpeed.ToString(), UpdateIcon(item.Icon)); } }
public static string ToJson(this DarkSky self) => JsonConvert.SerializeObject(self, Orai.Converter.Settings);