Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.