Compartilhar via


.NET 4 and VS 2010 to support Location API in all SKUs

Last year at PDC 2008, Microsoft first announced the Windows 7 Sensor and Location platform. Last month, we shipped Windows 7 worldwide, and the corresponding Windows 7 Sensor and Location platform. This is great because now sensor and location hardware manufacturers can easily integrate these devices with Windows. Software developers can also leverage our in-box Win32 COM (Sensors and Location) and IDispatch (Location only) APIs to integrate sensor and/or location functionality into their applications.

 

But one question I get frequently from developers is “What about .NET?”. Our answer until now has been to use our .NET interop samples, or to write their own interop code. But now I’m happy to say that .NET 4 and Visual Studio 2010 will support location functionality, which is new for the Beta 2 release.

 

Here are some fundamentals for location in .NET 4:

· New assembly: System.Device.dll, represents the PC/device

· New namespace: System.Device.Location, contains classes, data types, etc for location awareness

 

Here is a high-level diagram showing the core object model for this API:

 

... and here’s an introduction to how these objects are used:

GeoLocationProvider:
This is the “root object” for the API. It is used to access location data, status, as well as to get location and status updates. This is a value type, so you start by creating an instance of this type.

 

GeoLocation:
Represents the current location of the device/PC

 

GeoCoordinate:

Represents the position of the PC (latitude, longitude, etc)

 

CivicAddress:
Represents the CivicAddress corresponding to the location of the PC

 

GeoLocationStatus:
Represents the accessibility (whether you have permissions to access location data) and availability (is location data available at all) of the GeoLocationProvider

 

So, if you install .NET 4 / Visual Studio 2010 Beta 2, you can start to play with this new API!

 

I’ll be following up this post with more posts covering different aspects (in more detail) of what you can do with this new API.

 

**Note: There will be some changes in this object model coming for RC, so make sure to check back here if you are writing .NET 4 Location apps

 

See ya!

Gavin