StatusChangedEventArgs-Klasse

StatusChangedEventArgs Class

Stellt Informationen für das StatusChanged-Ereignis bereit.

Syntax


/* Weitere Informationen zum Erstellen oder Zugreifen auf dieses Objekt finden Sie unter "Hinweise". */

Attribute

[MarshalingBehavior(Agile)]
[Version(0x06020000)]

Member

StatusChangedEventArgsKlasse hat diese Membertypen:

Methoden

The StatusChangedEventArgs Klasse erbt Methoden von Object Klasse (C#/VB/C++).

Eigenschaften

Der StatusChangedEventArgsKlasse hat diese Eigenschaften.

EigenschaftZugriffstypBeschreibung

Status

SchreibgeschütztThe updated status of the Geolocator object.

 

Hinweise

Dieses Objekt ist das Argument, das an den Handler für das StatusChanged-Ereignis übergeben wird.

Beispiele

Dieses Codebeispiel veranschaulicht, wie das StatusChanged-Ereignis behandelt wird.



loc = new Windows.Devices.Geolocation.Geolocator();
// Add event handlers for the statuschanged event.
loc.addEventListener("statuschanged", onStatusChanged);

// Handler for statusChanged event.        
function onStatusChanged(args) {
    var newStatus = args.status;
        document.getElementById('geolocatorStatus').innerHTML =
            getStatusString(newStatus);
}

// display an appropriate error message
function getStatusString(locStatus) {
switch (locStatus) {
    case Windows.Devices.Geolocation.PositionStatus.ready:
        // Location data is available
        return "Location is available.";
                    break;
    case Windows.Devices.Geolocation.PositionStatus.initializing:
         // This status indicates that a location device is still initializing
         return "Location devices are still initializing."; 
         break;
    case Windows.Devices.Geolocation.PositionStatus.noData:
         // No location data is currently available
         return "Data from location services is currently unavailable.";
         break;
    case Windows.Devices.Geolocation.PositionStatus.disabled:
         // The app doesn't have permission to access location,
         // either because location has been turned off.
         return "Your location is currently turned off. " +
             "Change your settings through the Settings charm " +
             " to turn it back on.";
         break;
     case Windows.Devices.Geolocation.PositionStatus.notInitialized:
          // This status indicates that the app has not yet requested
          // location data by calling GetGeolocationAsync() or
          // registering an event handler for the positionChanged event.
          return "Location status is not initialized because " +
                        "the app has not requested location data.";
     case Windows.Devices.Geolocation.PositionStatus.notAvailable:
          // Location is not available on this version of Windows
          return "You do not have the required location services " +
              "present on your system.";
          break;
     default:
          return "Unknown status";
    }
}


Anforderungen

Mindestens unterstützter Client

Windows 8 [Nur Windows Store-Apps]

Mindestens unterstützter Server

Keine unterstützt [Nur Windows Store-Apps]

Mindestens unterstütztes Telefon

Windows Phone 8

Namespace

Windows.Devices.Geolocation
Windows::Devices::Geolocation [C++]

Metadaten

Windows.winmd

Capabilities

location
ID_CAP_LOCATION [Windows Phone]

 

 

Anzeigen:
© 2017 Microsoft