/// <summary> /// Initialize Earthquake Data when the app is loaded /// </summary> private void InitializeEarthquakeData() { var earthquakeData = EarthquakeServiceHelper.GetEarthuakeData(_hoursBefore); EarthquakeDataCollection = new ObservableCollection <EarthquakeDataModel>(); PopulateEarthquakeData(earthquakeData, false); Title = "Earthquake Activity since " + EarthquakeServiceHelper.StartTime.ToLocalTime(); SetTimer(_updateFrequencyInMinutes); }
/// <summary> /// Call the service helper to update the earthquake data /// </summary> private void UpdateEarthquakeData(object sender, EventArgs e) { if (EarthquakeDataCollection.Count > 0) { //Update start time to be 1 second after the last earthquake var startTime = EarthquakeDataCollection[0].DateTime.ToUniversalTime(); startTime = startTime.AddSeconds(1); var earthquakeData = EarthquakeServiceHelper.UpdateEarthquakeData(startTime); PopulateEarthquakeData(earthquakeData, true); } }