public void StopJourney() { JHStopwatch.Stop(); JHJourney.Duration = JHStopwatch.Elapsed; JHJourney.Distance = Distance; JHJourneyDB = new JourneyDB(); JHJourneyDB.AddJourney(JHJourney); JHIsRunning = 0; StartDistance = 0; }
public void UpdateTotalDistance() { SHDatabase = new JourneyDB(); SHJourneys = SHDatabase.GetJourneys(); TotalDistance = 0; //Add distance and duration from each data in the database foreach (var journey in SHJourneys) { TotalDistance += journey.Distance; TotalDuration += journey.Duration; } if (TotalDuration.TotalSeconds < 0.1) { AvgSpeed = 0; } else { AvgSpeed = 3.6 * (TotalDistance / TotalDuration.TotalSeconds) * 1000; } }
public StatisticsHandler() { SHDatabase = new JourneyDB(); SHJourneys = SHDatabase.GetJourneys(); }