GeoPositionStatus GeoPositionStatus GeoPositionStatus GeoPositionStatus Enum

Definition

Indicates the ability of the location provider to provide location updates.

public enum class GeoPositionStatus
public enum GeoPositionStatus
type GeoPositionStatus = 
Public Enum GeoPositionStatus
Inheritance
GeoPositionStatusGeoPositionStatusGeoPositionStatusGeoPositionStatus

Fields

Disabled Disabled Disabled Disabled 3

The location provider is disabled. On Windows 7, this is the case when the Sensor and Location platform has been disabled by group policy.

Initializing Initializing Initializing Initializing 1

The location provider is initializing. For example, a GPS that is still obtaining a fix has this status.

NoData NoData NoData NoData 2

No location data is available from any location provider. If the conditions for Disabled do not apply, GeoCoordinateWatcher has the NoData status before it is started and after it is stopped.

Ready Ready Ready Ready 0

A location provider is ready to supply new data.

Examples

The following example shows how to handle StatusChanged events and print out the current GeoPositionStatus.

using System;
using System.Device.Location;
namespace ShowStatusUpdates
{
    class Program
    {
        static void Main(string[] args)
        {
            ShowStatusUpdates();
        }

        static void ShowStatusUpdates()
        {
            GeoCoordinateWatcher watcher = new GeoCoordinateWatcher();
            watcher.Start();

            watcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(watcher_StatusChanged);

            Console.WriteLine("Enter any key to quit.");
            Console.ReadLine();

        }

        static void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e)
        {
            switch (e.Status)
            {
                case GeoPositionStatus.Initializing:
                    Console.WriteLine("Working on location fix");
                    break;

                case GeoPositionStatus.Ready:
                    Console.WriteLine("Have location");
                    break;

                case GeoPositionStatus.NoData:
                    Console.WriteLine("No data");
                    break;

                case GeoPositionStatus.Disabled:
                    Console.WriteLine("Disabled");
                    break;
            }
        }

    }
}
Imports System.Device.Location
Module GetLocationEvent

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

        Console.WriteLine("Enter any key to quit.")
        Console.ReadLine()
    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
                Console.WriteLine("Disabled")
        End Select
    End Sub

    Public Sub Main()
        ShowStatusUpdates()
    End Sub
End Module

Applies to