Export (0) Print
Expand All

GeoPositionStatus Enumeration

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

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

public enum GeoPositionStatus

Member nameDescription
DisabledThe location provider is disabled. On Windows 7, this is the case when the Sensor and Location platform has been disabled by group policy.
InitializingThe location provider is initializing. For example, a GPS that is still obtaining a fix has this status.
NoDataNo location data is available from any location provider.

If the conditions for Disabled do not apply, GeoCoordinateWatcher has this status before it has been started and after it has been stopped.

ReadyA location provider is ready to supply new data.

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;
            }
        }

    }
}

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft