ESRI.ArcGIS.Client.Toolkit.DataSources.KmlLayer.ConditionalRefresh C# (CSharp) Method

ConditionalRefresh() private method

If the region matches the map extent, download the URL immediately else set the flag NeedRefreshOnRegion for further refresh
private ConditionalRefresh ( Envelope region ) : void
region Envelope The region.
return void
        private void ConditionalRefresh(Envelope region)
        {
            if (IsInRegion(Map, region))
            {
                // Download the url
                _context = new KmlLayerContext { Images = new Dictionary<string, ImageBrush>() }; // reset the context
                _isLoading = true;
                NeedRefreshOnRegion = false;
                if (Url != null)
                    DownloadContent(Url);
            }
            else
            {
                // Delay refresh until the map fits the KML region
                NeedRefreshOnRegion = true;
                if (ChildLayers.Any())
                    ChildLayers.Clear();
                if (!IsInitialized)
                    base.Initialize(); // call Initialize though else could wait indefinitively for it
            }
        }