//--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 19JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * restart the worker thread in case worker thread is died.
  */
 public void RestartWorker()
 {
     lock (_threadListMutex)
     {
         _threadLists.Clear();
         for (int i = 0; i < _maxImageDownloadWorkder; i++)
         {
             if (_imageDownloadWorkers[i] != null)
             {
                 _imageDownloadWorkers[i].Stop();
                 _imageDownloadWorkers[i] = null;
             }
             _imageDownloadWorkers[i] = new MapTileDownloadWorker(this,
                     "MapTileDownloadWorker" + i);
             _imageDownloadWorkers[i].Start();
             _threadLists.Add("MapTileDownloadWorker" + i,
                     _imageDownloadWorkers[i]._mapTileDownloadWorkerThread);
         }
         if (_drawRoute)
         {
             _imageDownloadWorkers[_maxImageDownloadWorkder] = new MapDirectionRendererWorker(this);
             _threadLists.Add("MapDirectionRendererWorker",
                     _imageDownloadWorkers[_maxImageDownloadWorkder]._mapTileDownloadWorkerThread);
         }
     }
 }
        //--------------------------------- 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"};
            }
        }