public static void AddLocationToGeoData(GeoData geoData, Location location = null) { if (geoData == null) { return; } if (location == null) { location = DependencyService.Get <ILocationHandler>(DependencyFetchTarget.NewInstance) .GetLastLocationFromDevice(); } geoData.Location = location; }
public static int?AddGeoDataToJourney(GeoData geoData, Journey journey) { var journeyToCompare = journey; if (!JourneyCollection.Instance.Exists(j => j == journeyToCompare)) { return(null); } if (geoData == null) { return(null); } journey.Add(geoData); return(journey.IndexOf(geoData)); }
private void Test() { GeoDataHandler.CreateJourney("testjourney1", DateTime.Now); var newGeoData1 = new GeoData(); GeoDataHandler.AddLocationToGeoData(newGeoData1); newGeoData1.CaptureTime = DateTime.Now; GeoDataHandler.AddGeoDataToJourney(newGeoData1, JourneyCollection.Instance[0]); var newGeoData2 = new GeoData(); GeoDataHandler.AddLocationToGeoData(newGeoData2); newGeoData2.CaptureTime = DateTime.Now; GeoDataHandler.AddGeoDataToJourney(newGeoData2, JourneyCollection.Instance[0]); var newGeoData3 = new GeoData(); GeoDataHandler.AddLocationToGeoData(newGeoData3); newGeoData3.CaptureTime = DateTime.Now; GeoDataHandler.AddGeoDataToJourney(newGeoData3, JourneyCollection.Instance[0]); var t = JourneyCollection.Instance; }