System.Device.Location 命名空间

System.Device.Location 命名空间使应用程序开发人员可通过使用一个 API 方便地访问计算机的位置。 The System.Device.Location namespace allows application developers to easily access the computer's location by using a single API. 位置信息可能来自多个提供程序,例如 GPS、Wi-Fi 三角测量和移动电话塔三角测量。 Location information may come from multiple providers, such as GPS, Wi-Fi triangulation, and cell phone tower triangulation. System.Device.Location 类提供一个 API,用于在一台计算机上封装多个位置提供程序,并支持在这些提供程序之间无缝地区分优先级和转换。 The System.Device.Location classes provide a single API to encapsulate the multiple location providers on a computer and support seamless prioritization and transitioning between them. 因此,使用此 API 的应用程序开发人员不需要定制应用程序特定的硬件配置。 As a result, application developers who use this API do not need to tailor applications to specific hardware configurations.

CivicAddress

表示市政地址。Represents a civic address. 一个市政地址可以包括街道地址、邮政编码、省/直辖市/自治区和国家/地区等字段。A civic address can include fields such as street address, postal code, state/province, and country or region.

CivicAddressResolver

提供用于将基于坐标的位置解析为市政地址的功能。Provides functionality for resolving a coordinate-based location to a civic address.

GeoCoordinate

表示由纬度和经度坐标确定的地理位置。Represents a geographical location that is determined by latitude and longitude coordinates. 也可以包括海拔高度、精度、速度和航向信息。May also include altitude, accuracy, speed, and course information.

GeoCoordinateWatcher

提供基于纬度和经度坐标的位置数据。Supplies location data that is based on latitude and longitude coordinates.

GeoPosition<T>

包含 GeoPosition<T> 类的类型参数所指定类型的位置数据。Contains location data of a type specified by the type parameter of the GeoPosition<T> class.

GeoPositionChangedEventArgs<T>

PositionChanged 事件提供数据。Provides data for the PositionChanged event.

GeoPositionStatusChangedEventArgs

包含 GeoPositionStatusChanged 事件的数据。Contains data for a GeoPositionStatusChanged event.

ResolveAddressCompletedEventArgs

ResolveAddressCompleted 事件提供数据。Provides data for the ResolveAddressCompleted event.

接口

ICivicAddressResolver

提供一个可实现的用于将一个纬度/经度位置解析为市政地址的方法。Provides a method that when implemented, resolves a latitude/longitude location to a civic address.

IGeoPositionWatcher<T>

可实现来提供访问位置数据和接收位置更新的接口。Interface that can be implemented for providing accessing location data and receiving location updates.

枚举

GeoPositionAccuracy

为应用程序所使用的位置数据指定请求的精度级别。Specifies the requested accuracy level for the location data that the application uses.

GeoPositionPermission

指示调用应用程序是否拥有访问位置数据的权限。Indicates whether the calling application has permission to access location data.

GeoPositionStatus

指示位置提供程序提供位置更新的能力。Indicates the ability of the location provider to provide location updates.

注解

GeoCoordinateWatcher类提供基于纬度和经度坐标的位置数据。The GeoCoordinateWatcher class supplies location data that is based on latitude and longitude coordinates. CivicAddressResolverICivicAddressResolver类型提供了从坐标位置解析为市政地址的能力。The CivicAddressResolver and ICivicAddressResolver types provide the ability to resolve from a coordinate location to a civic address. 此外, IGeoPositionWatcher<T>还可以实现接口, 以扩展提供的位置数据的类型。Additionally, the IGeoPositionWatcher<T> interface can be implemented to extend the types of location data that are supplied.

在 Windows 7 中, 如果System.Device.Location安装了位置提供程序并可以确定计算机的位置, 则所有类都能完全正常运行。In Windows 7, all the System.Device.Location classes are fully functional if a location provider is installed and can determine the computer's location. 在 Windows 7 Starter Edition 上, 可在 "控制面板" 中设置的默认位置提供程序是唯一受支持的位置提供程序。On Windows 7 Starter Edition, the Default Location Provider that can be set in Control Panel is the only location provider that is supported.

注意在 Windows 7 之前的 Windows 版本中, 以下条件适用:Note In versions of Windows prior to Windows 7, the following conditions apply: