示例#1
0
 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;
 }
示例#2
0
 public void AddNewListener(PositionListener listener, out int id)
 {
     id = _lastID;
     _locationListeners.Add(id, listener);
     _lastID++;
 }
示例#3
0
 public void AddNewListener(PositionListener listener, out int id)
 {
     id = _lastID;
     _locationListeners.Add(id, listener);
     _lastID++;
 }