I have a button event that does the following:
Available = true
while (Available)
{
var cclient = new RestClient("http://192.168.1.1:1234/api/customers");
Log.log("http://192.168.1.1:1234/api/grab/customers");
var crequest = new RestRequest(Method.GET);
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"\"\r\n\r\n\r\n-----011000010111000001101001--", ParameterType.RequestBody);
IRestResponse cresponse = client.Execute(crequest);
Log.log(cresponse.StatusCode.ToString());
if (cresponse.StatusCode.ToString() == "OK")
{
List<Rate> result = JsonConvert.DeserializeObject<List<Rate>>(cresponse.Content);
var groupedData = from b in result.AsEnumerable()
group b by b.First_Name into g
select new
{
First_Name = g.Key,
//Count = g.Count(),
Qty = g.Sum(x => x.Qty)
};
foreach (var x in groupedData)
{
Log.log(x.First_Name + " " + x.Qty.ToString());
}
}
WaitSeconds(); //this waits 2 seconds to give it enough time to write to the log file
}
The while loop is happening...but it doesn't log data every two seconds like I am expecting it to.
I have a button that makes Available false and then it logs data.
I have tried placing this into a background worker and still does not log data.
I'm not sure why though.
Thanks,