private void UpdateMap(FortData pokestop) { SynchronizationContext.Post(o => { var pokeStopLoc = new PointLatLng(pokestop.Latitude, pokestop.Longitude); lock (_pokestopsOverlay.Markers) { for (var i = 0; i < _pokestopsOverlay.Markers.Count; i++) { var marker = _pokestopsOverlay.Markers[i]; if (marker.Position == pokeStopLoc) { _pokestopsOverlay.Markers.Remove(marker); } } } GMapMarker pokestopMarker = new GMapMarkerPokestops(pokeStopLoc, ResourceHelper.GetImage("Pokestop_looted")); //pokestopMarker.ToolTipMode = MarkerTooltipMode.OnMouseOver; //pokestopMarker.ToolTip = new GMapBaloonToolTip(pokestopMarker); _pokestopsOverlay.Markers.Add(pokestopMarker); }, null); }
private void InitializePokestopsAndRoute(List <FortData> pokeStops) { SynchronizationContext.Post(o => { _pokestopsOverlay.Markers.Clear(); _pokestopsOverlay.Routes.Clear(); _playerOverlay.Markers.Clear(); _playerOverlay.Routes.Clear(); _playerLocations.Clear(); var routePoint = (from pokeStop in pokeStops where pokeStop != null select new PointLatLng(pokeStop.Latitude, pokeStop.Longitude)).ToList(); _routePoints = routePoint; togglePrecalRoute.Enabled = true; var route = new GMapRoute(routePoint, "Walking Path") { Stroke = new Pen(Color.FromArgb(128, 0, 179, 253), 4) }; _pokestopsOverlay.Routes.Add(route); foreach (var pokeStop in pokeStops) { var pokeStopLoc = new PointLatLng(pokeStop.Latitude, pokeStop.Longitude); var pokestopMarker = new GMapMarkerPokestops(pokeStopLoc, ResourceHelper.GetImage("Pokestop")); _pokestopsOverlay.Markers.Add(pokestopMarker); } }, null); }