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
}
}