/// <summary> /// Refreshes the list of items obtained from the API and populates the view model /// </summary> public async Task Refresh() { // get bounding box of current map var topLeft = TheMap.ConvertViewportPointToGeoCoordinate(new Point(0, 0)); var bottomRight = TheMap.ConvertViewportPointToGeoCoordinate(new Point(TheMap.ActualWidth, TheMap.ActualHeight)); var box = new BoundingBox(topLeft.Latitude, bottomRight.Latitude, topLeft.Longitude, bottomRight.Longitude); // // TODO: invoke API that returns a list of point-of-interest items now in view on the map. This will populate // an observable collection of IMappable items on the ApiViewModel class (with the name Results). As that // collection is populated, the Results_CollectionChanged callback will fire to create the appropriate // point-of-interest pins and associate them with the map. // this.DefaultViewModel.ApiStatus = await _tomTomApi.GetCameras(box, (Int32)App.Current.Resources["MaxResults"]); // if there's a problem in the request, show a message box if (!DefaultViewModel.ApiStatus.IsSuccessStatusCode) { MessageBox.Show( String.Format("There was an error in handling the last request.\n\nCode: {0}\n\nMessage: {1}", (Int32)DefaultViewModel.ApiStatus.StatusCode, String.IsNullOrEmpty(DefaultViewModel.ApiStatus.Message) ? DefaultViewModel.ApiStatus.StatusCode.ToString() : DefaultViewModel.ApiStatus.Message), "Request Error", MessageBoxButton.OK); } }