Пример #1
0
        /// <summary>
        /// enqueueens tile to cache
        /// </summary>
        /// <param name="task"></param>
        void EnqueueCacheTask(CacheQueueItem task)
        {
            lock (tileCacheQueue)
            {
                if (!tileCacheQueue.Contains(task))
                {
                    Debug.WriteLine("EnqueueCacheTask: " + task);

                    tileCacheQueue.Enqueue(task);

                    if (CacheEngine != null && CacheEngine.IsAlive)
                    {
                        WaitForCache.Set();
                    }
#if PocketPC
                    else if (CacheEngine == null || CacheEngine.State == ThreadState.Stopped || CacheEngine.State == ThreadState.Unstarted)
#else
                    else if (CacheEngine == null || CacheEngine.ThreadState == System.Threading.ThreadState.Stopped || CacheEngine.ThreadState == System.Threading.ThreadState.Unstarted)
#endif
                    {
                        CacheEngine = null;
                        CacheEngine = new Thread(new ThreadStart(CacheEngineLoop))
                        {
                            Name         = "CacheEngine",
                            IsBackground = false,
                            Priority     = ThreadPriority.Lowest
                        };

                        abortCacheLoop = false;
                        CacheEngine.Start();
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        ///     enqueueens tile to cache
        /// </summary>
        /// <param name="task"></param>
        void EnqueueCacheTask(CacheQueueItem task)
        {
            lock (_tileCacheQueue)
            {
                if (!_tileCacheQueue.Contains(task))
                {
                    Debug.WriteLine("EnqueueCacheTask: " + task);

                    _tileCacheQueue.Enqueue(task);

                    if (_cacheEngine != null && _cacheEngine.IsAlive)
                    {
                        WaitForCache.Set();
                    }
                    else if (_cacheEngine == null || _cacheEngine.ThreadState == System.Threading.ThreadState.Stopped ||
                             _cacheEngine.ThreadState == System.Threading.ThreadState.Unstarted)
                    {
                        _cacheEngine              = null;
                        _cacheEngine              = new Thread(CacheEngineLoop);
                        _cacheEngine.Name         = "CacheEngine";
                        _cacheEngine.IsBackground = false;
                        _cacheEngine.Priority     = ThreadPriority.Lowest;

                        _abortCacheLoop = false;
                        _cacheEngine.Start();
                    }
                }
            }
        }