/// <summary> /// Save the referenced POIs to the target drive /// </summary> /// <param name="pointsOfInterest">The POIs to save</param> /// <param name="targetDrive">The Drive to Save the POIs to</param> /// <param name="backgroundWorker">instance of a background worker to update, null if not required</param> /// <returns>The number of POIs saved to the Drive</returns> public static int SavePois(Collection <PointOfInterestCategory> pointsOfInterest, string targetDrive, BackgroundWorker backgroundWorker) { PointOfInterestDatabase.BuildStaticContent(targetDrive, pointsOfInterest); string databaseLocation = PointOfInterestDatabase.BuildEmptyDatabase(targetDrive); int loadedWaypoints = PointOfInterestDatabase.Populate(databaseLocation, pointsOfInterest, backgroundWorker); PointOfInterestDatabase.CompleteDatabase(targetDrive); return(loadedWaypoints); }
/// <summary> /// Load POIs from the referenced drive /// </summary> /// <param name="sourceDrive">The source to load from</param> /// <returns>A collection of POI categories</returns> public static Collection <PointOfInterestCategory> LoadPois(string sourceDrive) { Collection <PointOfInterestCategory> currentPois = new Collection <PointOfInterestCategory>(); if (PointOfInterestDatabase.Exists(sourceDrive)) { currentPois = PointOfInterestDatabase.GetCategories(sourceDrive); foreach (PointOfInterestCategory currentCategory in currentPois) { currentCategory.Items.AddRange( PointOfInterestDatabase.GetPointsOfInterest(sourceDrive, currentCategory)); } } GC.Collect(); return(currentPois); }