in LocationHelper/LocationDataStore.cs [106:121]
public static async Task SaveLocationDataAsync(IEnumerable<LocationData> locations)
{
StorageFile sampleFile = await ApplicationData.Current.RoamingFolder.CreateFileAsync(
dataFileName, CreationCollisionOption.ReplaceExisting);
using (MemoryStream stream = new MemoryStream())
{
var serializer = new DataContractJsonSerializer(typeof(List<LocationData>));
serializer.WriteObject(stream, locations.ToList());
stream.Position = 0;
using (StreamReader reader = new StreamReader(stream))
{
string locationString = reader.ReadToEnd();
await FileIO.WriteTextAsync(sampleFile, locationString);
}
}
}