private void ClearLayers() { while (Map.Layers.Count > 0) { ILayer l = Map.Layers[0]; if (l.DataSource.IsOpen) { l.DataSource.Close(); } Map.Layers.Remove(l); l.DataSource.Dispose(); l.Dispose(); } Map.Layers.Clear(); }
public void Remove(ILayer featureLayer) { if (_layers == null) { return; } if (_layers.Contains(featureLayer)) { _layers.Remove(featureLayer); if (_onRemoveLayer != null) { _onRemoveLayer(this, featureLayer); } featureLayer.Dispose(); _layerIsChanged = true; } }
protected override void UpdateElement(Input oldElement, Context oldContext) { var childContext = child.Context; if (oldContext != Context) { if (Context.Layer != oldContext.Layer) { layer.Dispose(); layer = Context.Layer.AddChild(this); } childContext = new Context(Context, Layer); } child = child.UpdateElement(Element.Child, childContext); if (oldElement != Element) { ElementChanged?.Invoke(this, EventArgs.Empty); } }