public void AddGeoFence( GeoFence geoFence, ICallback callback )
{
if( fencesToCallback.ContainsKey( geoFence ) )
{
if( !fencesToCallback[ geoFence ].EqualCallbackParameter( callback ) )
throw new BackendlessException( String.Format( ExceptionMessage.GEOFENCE_ALREADY_MONITORING, geoFence.GeofenceName ) );
return;
}
if( !IsDefiniteRect( geoFence.NWPoint, geoFence.SEPoint ) )
DefiniteRect( geoFence );
this.fencesToCallback.Add( geoFence, callback );
if( location != null && IsPointInFence( new GeoPoint( location.Latitude, location.Longitude ), geoFence ) )
{
pointFences.Add( geoFence );
callback.CallOnEnter( geoFence, location );
AddOnStay( geoFence );
}
}