Ignorer les commandes du Ruban
Passer au contenu principal
Blog myTIC - Christophe Peerens > Billets > GPS – Windows Phone 7 – Step by step

 
Blog myTIC - Christophe Peerens > Billets > GPS – Windows Phone 7 – Step by step
octobre 19
GPS – Windows Phone 7 – Step by step

Dans le cadre des sessions sur Windows Phone 7.5, les démonstrations peuvent être reproduites en suivant les étapes décrites ci-dessous.

Les outils sont téléchargeable gratuitement via le lien suivant : http://create.msdn.com.

 

As part of the sessions on Windows Phone 7.5, the demonstrations may be reproduced by following the steps below.

The tools are downloadable for free via the following link: http://create.msdn.com.

 

Démonstration: utilisation du GPS

Demonstration: using the GPS

  • Créez un nouveau projet « Silverlight for Windows Phone - Windows Phone Application ».
  • Create a new "Silverlight for Windows Phone - Windows Phone Application" project.


  • Sélectionnez la plateforme cible 7.1.
  • Select the target OS 7.1.


  • Dans la page principale, rajouter via la « Toolbox », un objet de type « map ». Associer via la propriété « source » une image.
  • In the main page, add through the "Toolbox", an object of type "map". Link, through the « source » property, an image.


  • Rajouter la propriété « ZoomLevel » Sur l'objet map.
  • Add the "ZoomLevel" property to the map object.
ZoomLevel="16"
GeoCoordinateWatcher geoWatcher = new GeoCoordinateWatcher();
// Constructor
public MainPage()
{
     InitializeComponent();
     geoWatcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(geoWatcher_PositionChanged);
     geoWatcher.Start();
}
void geoWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
     Dispatcher.BeginInvoke(() =>
     {
          map1.Center = e.Position.Location;
     });
}
  • Compilez et testez dans l'émulateur.
  • Compile and test inside the emulator.


 

Attention: La couverture GPS n'est pas garantie. Il est à la responsabilité du développeur d'en tenir compte dans son développement. De même, l'objet « Map » nécessite une connexion data.

Warning: The GPS coverage is not guaranteed. It is the responsibility of the developer to take this into account in its development. Similarly, the object "Map" requires a data connection.

Commentaires

Aucun commentaire sur ce billet.