protected override BitmapImage DownloadBitmap(Uri uri) { BeginDownload(); BitmapImage result = null; try { result = _mapsHandler.GetTileBitmap(uri); if (result != null) { #if !DEBUG SaveCacheImage(result, uri); #endif } else { lock (this) { result = new System.Windows.Media.Imaging.BitmapImage(); result.BeginInit(); result.CacheOption = System.Windows.Media.Imaging.BitmapCacheOption.OnLoad; result.UriSource = Utils.ResourceHelper.GetResourceUri("/MapProviders/OSMBinMap/MissingTile.png"); result.EndInit(); result.Freeze(); } } } catch { result = null; RaiseDownloadError(); } finally { EndDownload(); } return(result); }