public void OnLocationChanged( double latitude, double longitude, double accuracy )
{
HashSet<GeoFence> oldFences, newFences, currFence;
lock( this )
{
this.location = new GeoPoint( latitude, longitude ); ;
oldFences = pointFences;
currFence = FindGeoPointsFence( location );
newFences = new HashSet<GeoFence>( currFence );
newFences.ExceptWith( oldFences );
oldFences.ExceptWith( currFence );
CallOnEnter( newFences );
CallOnStay( newFences );
CallOnExit( oldFences );
CancelOnStay( oldFences );
pointFences = currFence;
}
}