Skip to content

dotMorten/System.Device

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

System.Device

.NET Core 3.0 port of System.Device.Location APIs from .NET Reference Source.

Based on commit: https://github.com/microsoft/referencesource/commit/bf498ea2b1a6270a2fe5cb122acf4b1c5b45c21d

Original source code is MIT. See: https://github.com/microsoft/referencesource/blob/master/LICENSE.txt

Note:

The GeoCoordinate APIs are wrapping the Location COM APIs. Those were deprecated in Windows 8. If you don't need Windows 7 support, I'd encourage you to port your code to use the WinRT GeoLocation APIs instead. You can get these by adding a reference to Microsoft.Windows.SDK.Contracts.

Old System.Device.Location code:

var watcher = new System.Device.Location.GeoCoordinateWatcher(System.Device.Location.GeoPositionAccuracy.High);
watcher.StatusChanged += (s, e) => Debug.WriteLine($"Status changed: {e.Status}");
watcher.PositionChanged += (s, e) => Debug.WriteLine($"Position changed: {e.Position.Location.Latitude} , {e.Position.Location.Longitude} , {e.Position.Location.Altitude}  ");
watcher.Start();

New Windows.Devices.Geolocation equivalent code:

var locator = new Windows.Devices.Geolocation.Geolocator() { DesiredAccuracy = Windows.Devices.Geolocation.PositionAccuracy.High };
locator.StatusChanged += (s, e) => Debug.WriteLine($"Status changed: {e.Status}");
locator.PositionChanged += (s, e) => Debug.WriteLine($"Position changed: {e.Position.Coordinate.Point.Position.Latitude} , {e.Position.Coordinate.Point.Position.Longitude} , {e.Position.Coordinate.Point.Position.Altitude}  ");

About

Port of .NET Framework's System.Device APIs to .NET Core

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages