public static void PullAll() { foreach (Member mem in Member.list) { JsonMember jsTemp = Create(mem.intCID); if (jsTemp != null) { mem.strName = jsTemp.first + " " + jsTemp.last; mem.intRating = jsTemp.rating; } } }
private void BgwAPI_DoWork(object sender, DoWorkEventArgs e) { e.Result = new bool[] { true, true }; try { JsonMember.PullAll(); } catch { ((bool[])e.Result)[0] = false; MessageBox.Show("There was an error while accessing the VATSIM Member Data API.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } //try //{ DateTime dtStart = default; DateTime dtEnd = default; if (dtpDatStart.Enabled) { dtStart = dtpDatStart.Value; dtStart = new DateTime(dtStart.Year, dtStart.Month, dtStart.Day, 0, 0, 0); } if (dtpDatEnd.Enabled) { dtEnd = dtpDatEnd.Value; dtEnd = new DateTime(dtEnd.Year, dtEnd.Month, dtEnd.Day, 23, 59, 59); } JsonRecord.PullAll(dtStart, dtEnd); //} //catch //{ // ((bool[])e.Result)[1] = false; // MessageBox.Show("There was an error while accessing the VATSIM Statistics API. Note that the API will always fail if one of the requested members is currently online.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); //} }