private List <DownloadLevelTile> GetDownloadLevelTiles(DownloadLevelCfg downloadLevelCfg)
        {
            int count = downloadLevelCfg.TileGPoints.Count;
            List <DownloadLevelTile> downloadLevelTiles = new List <DownloadLevelTile>(count);

            for (int i = 0; i < count; ++i)
            {
                DownloadLevelTile downloadLevel = new DownloadLevelTile(downloadLevelCfg.TileGPoints[i], downloadLevelCfg.ZoomLevel);
                downloadLevelTiles.Add(downloadLevel);
            }

            return(downloadLevelTiles);
        }
 private void DownloadFailedTiles()
 {
     while (!IsComplete)
     {
         if (downloadFailedTiles.IsEmpty)
         {
             Thread.Sleep(5000);
             continue;
         }
         DownloadLevelTile tile = null;
         downloadFailedTiles.TryDequeue(out tile);
         if (tile != null)
         {
             GPoint p    = tile.TilePoint;
             int    zoom = tile.TileZoom;
             try
             {
                 if (CacheTiles(zoom, p, provider))
                 {
                     lock (locker)
                     {
                         ++downloadSize;
                         if (downloadSize == allTileSize)
                         {
                             IsComplete = true;
                         }
                     }
                 }
                 else
                 {
                     downloadFailedTiles.Enqueue(tile);
                 }
             }
             catch (Exception ex)
             {
             }
         }
     }
     log.Info("Download failed tiles complete.");
 }