private Task UpdateForActiveMap(bool activeMapChanged = true, Dictionary <MapMember, List <long> > mapSelection = null) { return(QueuedTask.Run(() => { SelectedLayerInfo selectedLayerInfo = null; if (!_selectedLayerInfos.ContainsKey(_activeMap)) { selectedLayerInfo = new SelectedLayerInfo(); _selectedLayerInfos.Add(_activeMap, selectedLayerInfo); } else { selectedLayerInfo = _selectedLayerInfos[_activeMap]; } if (activeMapChanged) { RefreshLayerCollection(); SetProperty(ref _selectedLayer, (selectedLayerInfo.SelectedLayer != null) ? selectedLayerInfo.SelectedLayer : Layers.FirstOrDefault(), () => SelectedLayer); if (_selectedLayer == null) { FrameworkApplication.SetCurrentToolAsync("esri_mapping_exploreTool"); return; } selectedLayerInfo.SelectedLayer = SelectedLayer; } if (SelectedLayer == null) { RefreshSelectionOIDs(new List <long>()); } else { List <long> oids = new List <long>(); if (mapSelection != null) { if (mapSelection.ContainsKey(SelectedLayer)) { oids.AddRange(mapSelection[SelectedLayer]); } } else { oids.AddRange(SelectedLayer.GetSelection().GetObjectIDs()); } RefreshSelectionOIDs(oids); } SetProperty(ref _selectedOID, (selectedLayerInfo.SelectedOID != null && LayerSelection.Contains(selectedLayerInfo.SelectedOID)) ? selectedLayerInfo.SelectedOID : LayerSelection.FirstOrDefault(), () => SelectedOID); selectedLayerInfo.SelectedOID = SelectedOID; ShowAttributes(); })); }
private Task UpdateForActiveMap(bool activeMapChanged = true, Dictionary<MapMember, List<long>> mapSelection = null) { return QueuedTask.Run(() => { SelectedLayerInfo selectedLayerInfo = null; if (!_selectedLayerInfos.ContainsKey(_activeMap)) { selectedLayerInfo = new SelectedLayerInfo(); _selectedLayerInfos.Add(_activeMap, selectedLayerInfo); } else selectedLayerInfo = _selectedLayerInfos[_activeMap]; if (activeMapChanged) { RefreshLayerCollection(); SetProperty(ref _selectedLayer, (selectedLayerInfo.SelectedLayer != null) ? selectedLayerInfo.SelectedLayer : Layers.FirstOrDefault(), () => SelectedLayer); if (_selectedLayer == null) { FrameworkApplication.SetCurrentToolAsync("esri_mapping_exploreTool"); return; } selectedLayerInfo.SelectedLayer = SelectedLayer; } if (SelectedLayer == null) RefreshSelectionOIDs(new List<long>()); else { List<long> oids = new List<long>(); if (mapSelection != null) { if (mapSelection.ContainsKey(SelectedLayer)) oids.AddRange(mapSelection[SelectedLayer]); } else { oids.AddRange(SelectedLayer.GetSelection().GetObjectIDs()); } RefreshSelectionOIDs(oids); } SetProperty(ref _selectedOID, (selectedLayerInfo.SelectedOID != null && LayerSelection.Contains(selectedLayerInfo.SelectedOID)) ? selectedLayerInfo.SelectedOID : LayerSelection.FirstOrDefault(), () => SelectedOID); selectedLayerInfo.SelectedOID = SelectedOID; ShowAttributes(); }); }