public DistTravelledViewModel(IWalkNavService navService) : base(navService) { this.Hours = 0; this.Minutes = 0; this.Seconds = 0; this.Travelled = 100; myLocation = DependencyService.Get <IWalkLocationService>(); myLocation.MyLocation += (object sender, IWalkCoordinates e) => { // Determine Distance Travelled if (_walkEntry != null && myLocation != null) { var distance = myLocation.GetDistanceTravelled(_walkEntry.Latitude, _walkEntry.Longitude); this.Travelled = distance; } }; myLocation.GetMyLocation(); }
public WalkEntryViewModel(IWalkNavService navService) : base(navService) { Title = "New Walk"; Difficulty = "Easy"; Distance = 1.0; // Get our Location Service myLocation = DependencyService.Get <IWalkLocationService>(); // Check to ensure that we have a value for our object if (myLocation != null) { myLocation.MyLocation += (object sender, IWalkCoordinates e) => { // Obtain our Latitude and Longitude coordinates Latitude = e.latitude; Longitude = e.longitude; }; } // Call our Service to get our GPS location myLocation.GetMyLocation(); }