Ejemplo n.º 1
0
        internal void childRemoved(DataSnapshot dataSnapshot)
        {
            string       key  = dataSnapshot.Key;
            LocationInfo info = GeoUtils.getMapSafe(key, locationInfos);

            if (info != null)
            {
                ValueChangedListenerSetup vs = new ValueChangedListenerSetup(geoFire.getDatabaseRefForKey(key), true, (s) => {
                    if (s.DatabaseError == null)
                    {
                        lock (Lock) {
                            GeoLocation location = GeoFire.getLocationValue(dataSnapshot);
                            GeoHash hash         = (location != null) ? new GeoHash(location) : null;
                            if (hash == null || !geoHashQueriesContainGeoHash(hash))
                            {
                                LocationInfo _info = GeoUtils.getMapSafe(key, locationInfos);
                                locationInfos.Remove(key);
                                if (_info != null && _info.inGeoQuery)
                                {
                                    foreach (GeoQueryEventListener listener in eventListeners)
                                    {
                                        geoFire.raiseEvent(() => {
                                            listener.onKeyExited(key);
                                        });
                                    }
                                }
                            }
                        }
                    }
                });
            }
        }
Ejemplo n.º 2
0
 private void addValueToReadyListener(Query firebase, GeoHashQuery query)
 {
     ValueChangedListenerSetup vs = new ValueChangedListenerSetup(firebase, true, (e) => {
         lock (Lock) {
             if (e.DatabaseError == null)
             {
                 this.outstandingQueries.Remove(query);
                 this.checkAndFireReady();
             }
             else
             {
                 foreach (GeoQueryEventListener listener in eventListeners)
                 {
                     geoFire.raiseEvent(() => {
                         listener.onGeoQueryError(e.DatabaseError);
                     });
                 }
             }
         }
     });
 }