//--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 19JUN2009  James Shen                 	          Initial Creation
        ////////////////////////////////////////////////////////////////////////////
        /**
         * Constructor.
         * @param mapDownloadingListener donwload listener
         * @param mapTileReader the map tile downloader.
         */
        public MapTileDownloadManager(IReaderListener mapDownloadingListener,
                MapTileAbstractReader mapTileReader)
        {
            _isCacheOn = MapConfiguration.IsCacheOn;
            _drawRoute = MapConfiguration.DrawRouting;
            _maxImageDownloadWorkder = MapConfiguration.WorkerThreadNumber;
            _maxBytesInCache = MapConfiguration.MapCacheSizeInBytes;
            _imageDownloadWorkers =
                new MapTileDownloadWorker[_maxImageDownloadWorkder + 1];
            _mapDownloadingListener = mapDownloadingListener;
            lock (_threadListMutex)
            {
                _threadLists.Clear();
                for (int i = 0; i < _maxImageDownloadWorkder; i++)
                {
                    if (mapTileReader != null)
                    {
                        _imageDownloadWorkers[i] =
                                new MapTileDownloadWorker(this, mapTileReader,
                                "MapTileDownloadWorker" + i);
                    }
                    else
                    {
                        _imageDownloadWorkers[i] = new MapTileDownloadWorker(this,
                                "MapTileDownloadWorker" + i);
                    }
                    _threadLists.Add("MapTileDownloadWorker" + i,
                            _imageDownloadWorkers[i]._mapTileDownloadWorkerThread);
                }
                if (_drawRoute)
                {
                    _imageDownloadWorkers[_maxImageDownloadWorkder] = new MapDirectionRendererWorker(this);
                    _threadLists.Add("MapDirectionRendererWorker",
                            _imageDownloadWorkers[_maxImageDownloadWorkder]._mapTileDownloadWorkerThread);
                }

                _mapTileDownloadManagerThread = new Thread(Run) {Name = "MapTileDownloadManager"};
            }
        }
 //--------------------------------- REVISIONS --------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ------------------
 // 19JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////
 /**
  * Constructor.
  * @param manager the downloade manager instance.
  * @param threadName the thread name.
  */
 internal MapTileDownloadWorker(MapTileDownloadManager manager,
         MapTileAbstractReader mapTileReader, string threadName)
 {
     _mapTileDownloadManager = manager;
     _threadName = threadName;
     _mapTileDownloadWorkerThread = new Thread(Run);
     _mapTileDownloadWorkerThread.Name = threadName;
     _mapTileReader = mapTileReader;
     _mapTileReader.SetMapDownloadingListener(manager._mapDownloadingListener);
 }