private void AddDrops(IList dropToAdd) { foreach (Drop drop in dropToAdd) { if (DropPins.All(x => x.Drop.Id != drop.Id)) { DropPins.Add(CreateDropPin(drop)); } } }
// 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)); } } } }