|
Cet article a fait l'objet d'une traduction automatique. Déplacez votre pointeur sur les phrases de l'article pour voir la version originale de ce texte. Informations supplémentaires.
|
Traduction
Source
|
GeoCoordinateWatcher, classe
Espace de noms : System.Device.Location
Assembly : System.Device (dans System.Device.dll)
Le type GeoCoordinateWatcher expose les membres suivants.
| Nom | Description | |
|---|---|---|
![]() | GeoCoordinateWatcher() | |
![]() | GeoCoordinateWatcher(GeoPositionAccuracy) |
| Nom | Description | |
|---|---|---|
![]() | DesiredAccuracy | |
![]() | MovementThreshold | |
![]() | Permission | |
![]() | Position | |
![]() | Status |
| Nom | Description | |
|---|---|---|
![]() | Dispose() | |
![]() | Dispose(Boolean) | |
![]() | Equals(Object) | |
![]() | Finalize | |
![]() | GetHashCode | |
![]() | GetType | |
![]() | MemberwiseClone | |
![]() | OnPositionChanged | |
![]() | OnPositionStatusChanged | |
![]() | OnPropertyChanged | |
![]() | Start() | |
![]() | Start(Boolean) | |
![]() | Stop | |
![]() | ToString | |
![]() | TryStart |
| Nom | Description | |
|---|---|---|
![]() | PositionChanged | |
![]() | StatusChanged |
| Nom | Description | |
|---|---|---|
![]() ![]() | IGeoPositionWatcher<GeoCoordinate>.PositionChanged | |
![]() ![]() | IGeoPositionWatcher<GeoCoordinate>.StatusChanged | |
![]() ![]() | INotifyPropertyChanged.PropertyChanged |
Remarque |
|---|
using System; using System.Device.Location; namespace GetLocationProperty { class Program { static void Main(string[] args) { GetLocationProperty(); } static void GetLocationProperty() { GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(); // Do not suppress prompt, and wait 1000 milliseconds to start. watcher.TryStart(false, TimeSpan.FromMilliseconds(1000)); GeoCoordinate coord = watcher.Position.Location; if (coord.IsUnknown != true) { Console.WriteLine("Lat: {0}, Long: {1}", coord.Latitude, coord.Longitude); } else { Console.WriteLine("Unknown latitude and longitude."); } } } }
using System; using System.Device.Location; namespace GetLocationEvent { class Program { static void Main(string[] args) { CLocation myLocation = new CLocation(); myLocation.GetLocationEvent(); Console.WriteLine("Enter any key to quit."); Console.ReadLine(); } class CLocation { GeoCoordinateWatcher watcher; public void GetLocationEvent() { this.watcher = new GeoCoordinateWatcher(); this.watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged); bool started = this.watcher.TryStart(false, TimeSpan.FromMilliseconds(2000)); if (!started) { Console.WriteLine("GeoCoordinateWatcher timed out on start."); } } void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e) { PrintPosition(e.Position.Location.Latitude, e.Position.Location.Longitude); } void PrintPosition(double Latitude, double Longitude) { Console.WriteLine("Latitude: {0}, Longitude {1}", Latitude, Longitude); } } } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (rôle principal du serveur non pris en charge), Windows Server 2008 R2 (rôle principal du serveur pris en charge avec SP1 ou version ultérieure ; Itanium non pris en charge)
Le .NET Framework ne prend pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.

