private void btnAddBaseLayer_Click(object sender, EventArgs e) { using (var picker = new ResourcePicker(_edSvc.CurrentConnection, ResourceTypes.LayerDefinition.ToString(), ResourcePickerMode.OpenResource)) { if (picker.ShowDialog() == DialogResult.OK) { LastSelectedFolder.FolderId = picker.SelectedFolder; string layerId = picker.ResourceID; IBaseMapGroup grp = null; var group = GetSelectedTiledLayerItem() as BaseLayerGroupItem; if (group != null) { grp = group.Tag; } else { grp = _tsd.GetFirstGroup(); if (grp == null) { grp = _tsd.AddBaseLayerGroup(GenerateBaseGroupName(_tsd)); } } var bl = grp.AddLayer(GenerateBaseLayerName(layerId, _tsd), layerId); _tiledLayerModel.Invalidate(); RestoreBaseLayerSelection(bl); } } }