public void Dispatch(JSPosition position)
 {
     Debug.WriteLine("Calling Dispatch position with watch: {0} Count: {1}", _watch, _locationListeners.Count);
     if (_locationListeners == null || _locationListeners.Count == 0)
     {
         return;
     }
     _deleteIDList.Clear();
     _dispatching = true;
     foreach (KeyValuePair <int, PositionListener> pair in _locationListeners)
     {
         PositionListener listener = pair.Value;
         Debug.WriteLine("Calling listener ApplyOption!");
         if (listener.ApplyOption())
         {
             Debug.WriteLine("Calling listener Dispatch!");
             listener.Dispatch(position);
             if (!_watch)
             {
                 _deleteIDList.Add(pair.Key);
             }
         }
     }
     foreach (int id in _deleteIDList)
     {
         Debug.WriteLine("Removing position listener {0}!", id);
         _locationListeners.Remove(id);
     }
     _dispatching = false;
 }
Exemple #2
0
 public void AddNewListener(PositionListener listener, out int id)
 {
     id = _lastID;
     _locationListeners.Add(id, listener);
     _lastID++;
 }
 public void AddNewListener(PositionListener listener, out int id)
 {
     id = _lastID;
     _locationListeners.Add(id, listener);
     _lastID++;
 }