private void ClearStops()
 {
     foreach (var item in StopIconWrappers)
     {
         MapElementsShown.Remove(item.Element);
     }
     StopIconWrappers.Clear();
 }
 private void RemoveStopsFromMap(params string[] stops)
 {
     foreach (var item in StopIconWrappers.ToArray())
     {
         if (stops.Contains(AttachedProperties.GetElementID(item.Element)))
         {
             MapElementsShown.Remove(item.Element);
             StopIconWrappers.Remove(item);
         }
     }
 }
        public CurrentLocationAddIn()
        {
            SetLastKnownLocation();
            MapElementsShown.Add(LocationIcon);
            WeakEventListener <CurrentLocationAddIn, object, PositionChangedEventArgs> positionChangedEventListener = new WeakEventListener <CurrentLocationAddIn, object, PositionChangedEventArgs>(this);

            positionChangedEventListener.OnEventAction = (t, s, e) => t.LocationHelper_LocationChanged(s, e);
            LocationHelper.LocationChanged            += positionChangedEventListener.OnEvent;
            WeakEventListener <CurrentLocationAddIn, object, StatusChangedEventArgs> statusChangedEventListener = new WeakEventListener <CurrentLocationAddIn, object, StatusChangedEventArgs>(this);

            statusChangedEventListener.OnEventAction = (t, s, e) => t.LocationHelper_StatusChanged(s, e);
            LocationHelper.StatusChanged            += statusChangedEventListener.OnEvent;
        }
        private bool RemoveVehicle(RealTimeArrival arrival)
        {
            var key = new Tuple <string, string>(arrival.Stop, arrival.Trip);

            if (VehicleWrappers.ContainsKey(key))
            {
                var tviw = VehicleWrappers[key];
                MapElementsShown.Remove(tviw.Element);
                VehicleWrappers.Remove(key);
                return(true);
            }
            return(false);
        }
        private void SetVehicle(RealTimeArrival arrival)
        {
            var key = new Tuple <string, string>(arrival.Stop, arrival.Trip);

            if (VehicleWrappers.ContainsKey(key))
            {
                var tviw = VehicleWrappers[key];
                tviw.Arrival         = arrival;
                VehicleWrappers[key] = tviw;
            }
            else
            {
                TransitVehicleIconWrapper tviw = new TransitVehicleIconWrapper();
                tviw.Arrival = arrival;
                MapElementsShown.Add(tviw.Element);
                VehicleWrappers.Add(key, tviw);
            }
        }
 private void AddStopsToMap(params TransitStop[] stops)
 {
     foreach (var stop in stops)
     {
         TransitStopIconWrapper wrapper = new TransitStopIconWrapper(stop)
         {
             StopSize = this.StopSize
         };
         if (stop.Children != null)
         {
             HiddenStops.AddRange(stop.Children);
             RemoveStopsFromMap(stop.Children);
         }
         StopIconWrappers.Add(wrapper);
         if (!HiddenStops.Contains(stop.ID))
         {
             MapElementsShown.Add(wrapper.Element);
         }
     }
 }
 private void ClearVehicles()
 {
     VehicleWrappers.Clear();
     MapElementsShown.Clear();
 }