Skip to content

Instantly share code, notes, and snippets.

@MatthewKing
Last active August 29, 2015 13:58
Show Gist options
  • Save MatthewKing/10222964 to your computer and use it in GitHub Desktop.
Save MatthewKing/10222964 to your computer and use it in GitHub Desktop.
Fixes the dodgy miswired events in Microsoft's base GeoCoordinateWatcher implementation.
using System;
using System.Device.Location;
/// <summary>
/// Supplies location data that is based on latitude and longitude coordinates.
/// </summary>
/// <remarks>
/// Fixes the dodgy miswired events in Microsoft's base GeoCoordinateWatcher implementation.
/// </remarks>
class GeoCoordinateWatcherFixed : GeoCoordinateWatcher, IGeoPositionWatcher<GeoCoordinate>
{
/// <summary>
/// Occurs when the System.Device.Location.IGeoPositionWatcher&lt;GeoCoordinate&gt;.Position property changes.
/// </summary>
event EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>> IGeoPositionWatcher<GeoCoordinate>.PositionChanged
{
add { base.PositionChanged += value; }
remove { base.PositionChanged -= value; }
}
/// <summary>
/// Occurs when the System.Device.Location.IGeoPositionWatcher&lt;GeoCoordinate&gt;.Status property changes
/// </summary>
event EventHandler<GeoPositionStatusChangedEventArgs> IGeoPositionWatcher<GeoCoordinate>.StatusChanged
{
add { base.StatusChanged += value; }
remove { base.StatusChanged -= value; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment