/// <summary> /// Update fields of VM from the location /// </summary> /// <param name="location"></param> public void UpdateFromLocation() { // Rezoom map if (TrackingPage.CurrentInstance.ReZoomMap) { TrackingPage.CurrentInstance.CenterAndZoom(); } // Update speed tracker this.SpeedTracker.AddPosition(LocationTracker.Location); if (!this.ManualEnabled) { this.NotifyPropertyChanged("Threshold"); this.NotifyPropertyChanged("ThresholdString"); } // Notify properties this.NotifyPropertyChanged("MyLocation"); this.NotifyPropertyChanged("DistanceLeft"); this.NotifyPropertyChanged("DistanceString"); this.NotifyPropertyChanged("EstimatedTimeString"); this.NotifyPropertyChanged("AverageSpeedString"); // Raise alarm if (this.DistanceLeft.MetersToMiles() <= this.Threshold) { LocationTracker.StopTracking(); //MessageBox.Show("Your stop is coming up soon!", "Non-final alarm", MessageBoxButton.OK); AlarmHandler.Instance.TriggerAlarm(this.Context); } this.NotifyPropertyChanged("LeftButtonText"); }
/// <summary> /// Stop the geofencing. /// This should only be called in foreground. /// </summary> public void StopGeofence() { LocationTracker.StopTracking(); this.NotifyLeftButton(); AlarmHandler.Instance.ClearAlarms(); }