protected override void Start() { if (!_enabled) { return; } _isStarted = true; _imageBoxEnumerator = new ViewerFrameEnumerator(ImageViewer, SelectedImageBoxWeight, UnselectedImageBoxWeight, FrameLookAheadCount.GetValueOrDefault(-1), CanRetrieveFrame); _retrieveThreadPool = new FrameBlockingThreadPool(_imageBoxEnumerator, DoRetrieveFrame) { ThreadPoolName = GetThreadPoolName("Retrieve"), Concurrency = RetrievalThreadConcurrency, ThreadPriority = _retrievalThreadPriority }; _retrieveThreadPool.Start(); if (DecompressionThreadConcurrency <= 0) { return; } _decompressThreadPool = new SimpleBlockingThreadPool(DecompressionThreadConcurrency) { ThreadPoolName = GetThreadPoolName("Decompress"), ThreadPriority = _decompressionThreadPriority }; _decompressThreadPool.Start(); }
protected override void Stop() { if (_retrieveThreadPool != null) { _retrieveThreadPool.Stop(false); _retrieveThreadPool = null; } if (_decompressThreadPool != null) { _decompressThreadPool.Stop(false); _decompressThreadPool = null; } if (_imageBoxEnumerator != null) { _imageBoxEnumerator.Dispose(); _imageBoxEnumerator = null; } _isStarted = false; }