BackendlessAPI.Geo.Fence.GeoFenceMonitoring.AddGeoFence C# (CSharp) Méthode

AddGeoFence() public méthode

public AddGeoFence ( BackendlessAPI.Geo.Fence.GeoFence geoFence, ICallback callback ) : void
geoFence BackendlessAPI.Geo.Fence.GeoFence
callback ICallback
Résultat void
    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 );
      }
    }