private void UpdateDataConstantly()
{
/*
//resetting arrarylist..
temp2_AL.Clear();
hum2_AL.Clear();
//We are using JSON.NET library to parse the json file and get the data form it..
if (tb_lat.Text != null && tb_long.Text != null)
{
try
{
using (var wc = new WebClient())
{
// var json = await httpClient.GetStringAsync(api_url);
//pulling the saved data form text file....
string path = AppDomain.CurrentDomain.BaseDirectory + @"long_lat_value.txt";
string[] lines = System.IO.File.ReadAllLines(path);
double lat_val = Double.Parse(lines[0]);
double lng_val = Double.Parse(lines[1]);
string api_url = "http://api.openweathermap.org/data/2.5/station/find?lat=" + lat_val + "&lon=" + lng_val + "&APPID=615afd606af791f572a1f92b27a68bcd";
var data = wc.DownloadString(api_url);
// MessageBox.Show("Data = " + data);
try
{
var jArray = JArray.Parse(data);
foreach (var result in jArray.Children<JObject>())
{
try
{
if ((result["last"]["main"]["temp"] != null) && (result["last"]["main"]["humidity"] != null))
{
string tem = result["last"]["main"]["temp"].ToString();
// MessageBox.Show("tem = " + tem);
double kelvin = double.Parse(tem);
double degree = Math.Round(kelvin - 273.15);
temp_AL.Add((int)degree);
//for humidity part
string tem2 = result["last"]["main"]["humidity"].ToString();
//lets divide the humidity by 100 to convert it to decimal value...
double hum = double.Parse(tem2);
//MessageBox.Show("hum = " + hum);
hum_AL.Add(hum);
}
}
catch (Exception ex)
{
MessageBox.Show("bbk message = " + ex.Message);
}
}
//now lets test these
//string test = null;
//string test2 = null;
//for (int i = 0; i < temp_AL.Count; i++)
//{
// test += temp_AL[i] + " , \t";
// test2 += hum_AL[i] + ", \t";
//}
//MessageBox.Show("temperature pulled t = " + test);
//MessageBox.Show("humidity pulled h = " + test2);
//test = null;
// test2 = null;
}
catch (Exception ex)
{
MessageBox.Show("exception = " + ex.Message);
}
//now lets load the map if not loaded if loaded dont need to load the map..
try
{
if (map_loaded == 0)
{
//not loaded so load..
button1.PerformClick();
}
//testing..
// string s = null;
for (int i = 0; i < temp_AL.Count; i++)
{
//calling the plot function to plot the values...
double DBT = double.Parse(temp_AL[i].ToString());
double RH = (double)double.Parse(hum_AL[i].ToString()) / 100;
// s += "(DBT = " + DBT + ",HR= " + RH + ") \n";
//plot_by_DBT_HR(t, h);//div by 100 because 34% = 34/100 so..
plot_by_DBT_HR(DBT, RH);
}
// MessageBox.Show("val = " + s);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}//close of if...
*/
}
private System.Windows.Forms.Timer timer1;