private async void OnMapPointToolActivated(object obj) { var addList = new List <tempProGraphic>(); var removeList = new List <ProGraphic>(); foreach (var item in ProGraphicsList) { if (item.Disposable != null || item.IsTemp == false) { continue; } // re-add graphic to map overlay SimpleMarkerStyle ms = SimpleMarkerStyle.Circle; CIMColor color = ColorFactory.BlueRGB; if (item.Tag == "target") { ms = SimpleMarkerStyle.Square; color = ColorFactory.RedRGB; } addList.Add(new tempProGraphic() { GUID = item.GUID, Geometry = item.Geometry, Color = color, IsTemp = true, Size = 5.0, MarkerStyle = ms }); } foreach (var temp in addList) { var pgOLD = ProGraphicsList.FirstOrDefault(g => g.GUID == temp.GUID); var guid = await AddGraphicToMap(temp.Geometry, temp.Color, temp.IsTemp, temp.Size, markerStyle : temp.MarkerStyle, tag : pgOLD.Tag); var pgNew = ProGraphicsList.FirstOrDefault(g => g.GUID == guid); pgNew.GUID = pgOLD.GUID; removeList.Add(pgOLD); } foreach (var pg in removeList) { ProGraphicsList.Remove(pg); } }
private void RemoveGraphics(List <string> guidList) { var list = ProGraphicsList.Where(g => guidList.Contains(g.GUID)).ToList(); foreach (var graphic in list) { if (graphic.Disposable != null) { graphic.Disposable.Dispose(); } ProGraphicsList.Remove(graphic); } //TODO do we still use HasMapGraphics? //RaisePropertyChanged(() => HasMapGraphics); }