GeoCoordinateWatcher.StatusChanged Event

.NET Framework (current version)

Indicates that the status of the GeoCoordinateWatcher object has changed.

Namespace:   System.Device.Location
Assembly:  System.Device (in System.Device.dll)

Public Event StatusChanged As EventHandler(Of GeoPositionStatusChangedEventArgs)

The StatusChanged event is raised on the same thread that the GeoCoordinateWatcher object was created on.

The following example demonstrates how to handle StatusChanged events.

Imports System.Device.Location
Module GetLocationEvent

    Sub ShowStatusUpdates()
        Dim Watcher As GeoCoordinateWatcher
        Watcher = New GeoCoordinateWatcher()
        AddHandler Watcher.StatusChanged, AddressOf watcher_StatusChanged

        Console.WriteLine("Enter any key to quit.")
    End Sub

    Sub watcher_StatusChanged(ByVal sender As Object, ByVal e As GeoPositionStatusChangedEventArgs)
        Select Case e.Status
            Case GeoPositionStatus.Initializing
                Console.WriteLine("Working on location fix")
            Case GeoPositionStatus.Ready
                Console.WriteLine("Have location")
            Case GeoPositionStatus.NoData
                Console.WriteLine("No data")
            Case GeoPositionStatus.Disabled
        End Select
    End Sub

    Public Sub Main()
    End Sub
End Module

.NET Framework
Available since 4.0
Windows Phone Silverlight
Available since 7.0
Return to top