private async Task GetSampleDataAsync() { if (this._groups.Count != 0) { return; } Uri dataUri = new Uri("ms-appx:///DataModel/SampleData.json"); StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(dataUri); string jsonText = await FileIO.ReadTextAsync(file); JsonObject jsonObject = JsonObject.Parse(jsonText); JsonArray jsonArray = jsonObject["PointsOfInterest"].GetArray(); foreach (JsonValue groupValue in jsonArray) { JsonObject groupObject = groupValue.GetObject(); IJsonValue shapeValue; List <BasicGeoposition> shapeList; Geopath shapePath = null; if (groupObject.TryGetValue("Shape", out shapeValue)) { //JsonObject shapeObject = shapeValue.GetObject(); string shape = shapeValue.GetString(); if (PathParser.TryParseEncodedValue(shape, out shapeList)) { shapePath = new Geopath(shapeList); } } IJsonValue bestMapViewBoxValue; List <BasicGeoposition> bestMapViewBoxList = new List <BasicGeoposition>(); GeoboundingBox bestMapViewBox = null; if (groupObject.TryGetValue("BestMapViewBox", out bestMapViewBoxValue)) { foreach (JsonValue itemValue in bestMapViewBoxValue.GetArray()) { JsonObject itemObject = itemValue.GetObject(); IJsonValue locationValue = itemObject["location"]; JsonObject locationObject = locationValue.GetObject(); BasicGeoposition location = new BasicGeoposition { Latitude = locationObject["lat"].GetNumber(), Longitude = locationObject["lng"].GetNumber() }; bestMapViewBoxList.Add(location); } bestMapViewBox = GeoboundingBox.TryCompute(bestMapViewBoxList); } SampleDataGroup group = new SampleDataGroup(groupObject["UniqueId"].GetString(), groupObject["Title"].GetString(), groupObject["Subtitle"].GetString(), groupObject["ImagePath"].GetString(), groupObject["Description"].GetString(), bestMapViewBox, shapePath); foreach (JsonValue itemValue in groupObject["Items"].GetArray()) { JsonObject itemObject = itemValue.GetObject(); IJsonValue geometryValue; Geopoint location = null; string address = null; if (itemObject.TryGetValue("geometry", out geometryValue)) { JsonObject geometryObject = geometryValue.GetObject(); IJsonValue locationValue = geometryObject["location"]; JsonObject locationObject = locationValue.GetObject(); location = new Geopoint(new BasicGeoposition { Latitude = locationObject["lat"].GetNumber(), Longitude = locationObject["lng"].GetNumber() }); } IJsonValue addressValue = null; if (itemObject.TryGetValue("formatted_address", out addressValue)) { address = addressValue.GetString(); } group.Items.Add(new SampleDataItem(itemObject["UniqueId"].GetString(), itemObject["Title"].GetString(), itemObject["Subtitle"].GetString(), itemObject["ImagePath"].GetString(), itemObject["Description"].GetString(), itemObject["Content"].GetString(), location, address)); } this.Groups.Add(group); } }