public void RemoveLayer(string name) { CycloMediaLayer layer = Layers.Aggregate <CycloMediaLayer, CycloMediaLayer> (null, (current, checkLayer) => (checkLayer.Name == name) ? checkLayer : current); if (layer != null) { Layers.Remove(layer); layer.Dispose(); IActiveView activeView = ArcUtils.ActiveView; if (activeView != null) { activeView.ContentsChanged(); activeView.Refresh(); } } }
public void Dispose() { int i = 0; while (Layers.Count > i) { CycloMediaLayer layer = Layers[i]; layer.Dispose(); if (layer is WfsLayer) { Layers.Remove(layer); } else { i++; } } IActiveView activeView = ArcUtils.ActiveView; IMap map = ArcUtils.Map; if ((activeView != null) && (map != null)) { var layer = GroupLayer as ILayer; if (layer != null) { map.DeleteLayer(layer); } activeView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); } var avEvents = ArcUtils.ActiveViewEvents; if (avEvents != null) { avEvents.ContentsChanged -= OnContentChanged; } }