Domanda

I'm working with windows phone apps and I'm using here rest places api for my data and i retrieving data as json that give me information about location nearby like this

position: [ 37.77704 , -122.39494 ]
distance: 1241
title: Caltrain-San Francisco
averageRating: 0.0
category: { Public transport }
icon: http://download.vcdn.nokia.com/p/d/places2/icons/categories/11.icon
vicinity: 700 4th St<br/>San Francisco, CA 94107
having: [ ]
type: urn:nlp-types:place
href: http://demo.places.nlp.nokia.com/places/v1/places/8409q8yy-a7395cccbfc4474ba469f3ddc03e041b;context=Zmxvdy1pZD00OWQxZDY0Zi0zODc5LTVlNDAtOWY4ZC04ZGFmNWMyMGZhZDFfMTM4OTg4NDQxMzUxNV8wXzM1MjkmcmFuaz0w?app_id=lp3VaO8uhOFe0akZ4J1m&app_code=JwL7MNaSarML92oqEDshAg
id: 8409q8yy-a7395cccbfc4474ba469f3ddc03e041b

and i notice that if i open

href: http://demo.places.nlp.nokia.com/places/v1/places/8409q8yy-a7395cccbfc4474ba469f3ddc03e041b;context=Zmxvdy1pZD00OWQxZDY0Zi0zODc5LTVlNDAtOWY4ZC04ZGFmNWMyMGZhZDFfMTM4OTg4NDQxMzUxNV8wXzM1MjkmcmFuaz0w?app_id=lp3VaO8uhOFe0akZ4J1m&app_code=JwL7MNaSarML92oqEDshAg

i will go into other page that contain much detailed information about that location, so how can i get all of this data?the general and detailed data from that href

method that i using to get general data is using this

WebClient client = new WebClient();
Uri uri = new Uri(transportURL1 + latitude + "%2C" + longitude + transportURL2, UriKind.Absolute);
client.DownloadStringCompleted += (s, e) =>
{
   if (e.Error == null)
    {
      RootObject result = JsonConvert.DeserializeObject<RootObject>(e.Result);
                        hereRestProperty = new ObservableCollection<Item>(result.results.items);
   }
   else
   {
       MessageBox.Show(e.Error.ToString());
   }
};
client.DownloadStringAsync(uri);

so my app scenario is mainpage showing general location data and when I tap one of the location data it will navigate to detailpage that contain information from that href

how to do that?

edit: my work around is getting href and using that href to calling http request but i have no idea how to do all that...

edit2: after looking around I come up with idea of having mainpage with list of general information and if I click into one of the item in list it will navigate me to detailpage that will request from that href but i just don't know how to execute that in mvvm aproach...

È stato utile?

Soluzione

If it is safe to assume that you are trying to add value to your app by adding a places feature, I would suggest that for Windows Phone 8 you would be better off launching HERE Maps directly using the HERE Maps Launchers API

For example, if your app is about hiking trails it would make sense to add a feature for finding details of places to eat or stay near that hiking trail - but you wouldn't need to create your own code to request, format and display the in-depth places data, just fire up the Maps app already on the device (passing in the href from the initial REST request if necessary). The advantage of doing this is threefold, firstly you can add this feature in four lines of code, secondly the user is presented with the places information in a familiar format, and finally information is retrieved from the device itself which alleviates the need to make additional HTTP requests.

One or more of the following tasks may be useful:

  • ExploremapsShowPlaceTask allows you to start the Maps application with the map centered to a place shown in the map.
  • ExploremapsSearchPlacesTask allows you to start the Maps application with the search view.
  • ExploremapsExplorePlacesTask allows you to start the Maps application where the nearby places of interest are shown.
  • PlacesShowDetailsByLocationTask allows you to start the Maps application with the places view for the selected place.
  • PlacesShowDetailsByIdHrefTask allows you to start the Maps application with the places view for the selected place.

Note that if HERE Maps is not installed on the Windows Phone 8 device, the user will be directed to download it for free from the app store.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top