Example #1
0
 private void AddDrops(IList dropToAdd)
 {
     foreach (Drop drop in dropToAdd)
     {
         if (DropPins.All(x => x.Drop.Id != drop.Id))
         {
             DropPins.Add(CreateDropPin(drop));
         }
     }
 }
Example #2
0
        private void RemoveDrops(IList dropsToRemove)
        {
            foreach (Drop removedDrop in dropsToRemove)
            {
                var removedDropPin = DropPins.FirstOrDefault(x => x.Drop.Id == removedDrop.Id);

                if (removedDropPin != null)
                {
                    DropPins.Remove(removedDropPin);
                }
            }
        }
Example #3
0
        // add all drops from server to the map
        public async Task ShowAllDrops(MapSpan currentMapVisibleRegion)
        {
            if (currentMapVisibleRegion != null)
            {
                SetMapCoordinates(currentMapVisibleRegion);
                var dropsResult = await _dropService.GetDropsForMap(_mapNorth, _mapSouth, _mapWest, _mapEast);

                foreach (var drop in dropsResult.Drops)
                {
                    if (DropPins.All(x => x.Drop.Id != drop.Id &&
                                     (x.Drop.Lat != drop.Lat && // needed
                                      x.Drop.Lon != drop.Lon && // due to
                                      x.Drop.Title != drop.Title))) // xamarin features
                    {
                        DropPins.Add(CreateDropPin(drop));
                    }
                }
            }
        }