private void DeleteLMLocation(object sender, RoutedEventArgs e) { MenuItem menuItem = (MenuItem)sender; LMLocation lmLoc = menuItem.DataContext as LMLocation; lmLocationHelper.LMLocationDelete(lmLoc); refreshLMLocations(lmLoc); }
public void AddLMLocation(LMLocation location) { SQLiteConnection conn = new SQLiteConnection(DB_PATH); LMLocationDB newLocation = new LMLocationDB() { Latitude = location.Latitude, Longitude = location.Longitude, LMDateTime = location.LMDateTime, Duration = location.Duration, Name = location.Name }; // Delete any saved locations before inserting new one. conn.Insert(newLocation); }
private async void NavigateLMLocation(object sender, RoutedEventArgs e) { MenuItem menuItem = (MenuItem)sender; LMLocation lmLoc = menuItem.DataContext as LMLocation; if (lmLoc != null) { // Assemble the Uri to launch. Uri uri = new Uri("ms-drive-to:?destination.latitude=" + lmLoc.Latitude + "&destination.longitude=" + lmLoc.Longitude + "&destination.name=" + lmLoc.Name); // Launch the Uri. var success = await Windows.System.Launcher.LaunchUriAsync(uri); } }
public List <LMLocation> retrieveMostFrequentLMLocations() { SQLiteConnection conn = new SQLiteConnection(DB_PATH); int frequency = 0; string query = "SELECT * FROM LMLOCATION ORDER BY LMLOCATION.DURATION DESC"; List <LMLocationDB> locations = conn.Query <LMLocationDB>(query); List <LMLocation> LMLocations = new List <LMLocation>(); foreach (LMLocationDB loc in locations) { LMLocation lmLocation = new LMLocation(loc.Id, frequency, loc.Latitude, loc.Longitude, loc.LMDateTime, loc.Duration, loc.Name); LMLocations.Add(lmLocation); frequency++; } return(LMLocations); }
private void refreshLMLocations(LMLocation lmLocation = null) { frequentLMLocations = lmLocationHelper.GetMostFrequentLocations(); MyCoordinates.Clear(); foreach (LMLocation lmLoc in frequentLMLocations) { MyCoordinates.Add(new GeoCoordinate { Latitude = lmLoc.Latitude, Longitude = lmLoc.Longitude }); } LocList.ItemsSource = frequentLMLocations; //FrequentLocationsMap.Layers.Clear(); //DrawMapMarkers(); //FrequentLocationsMap.SetView(frequentLMLocations.First<LMLocation>().Coordinate, 12); // Set the center of the FrequentLocationsMap }
public void LMLocationDelete(LMLocation loc) { DatabaseMgr dbMgr = new DatabaseMgr(); dbMgr.DeleteLMLocation(loc); }