Dispose() public method

public Dispose ( ) : void
return void
Ejemplo n.º 1
0
        private void RespCallback(IAsyncResult iar)
        {
            Requests request = (Requests)iar.AsyncState;

            try
            {
                request.Response = (HttpWebResponse)request.Request.EndGetResponse(iar);
                string text = request.ToString();
                if (!string.IsNullOrEmpty(text))
                {
                    Block block = new Block(text, request.Entry);
                    lock (_threadLock)
                        _pages.Enqueue(block);
                }
            }
            catch
            {
            }
            finally
            {
                request.Dispose();
            }

            _semaphore.Release();
            _background.ReportProgress(PercentProgress);
        }
Ejemplo n.º 2
0
        private void RespCallback(IAsyncResult iar)
        {
            Requests request = (Requests)iar.AsyncState;

            string page;
            bool   success = request.EndGetResponse(iar, out page);

            lock (m_locker)
            {
                if (success)
                {
                    m_parser.TryParse(page, request.Id);
                }
                else if (m_storeUnprocessedIds)
                {
                    m_badIds.Enqueue(request.Id);
                }
            }
            request.Dispose();
            m_semaphore.Release();

            if (success && PageDownloadingComplete != null)
            {
                PageDownloadingComplete(null, EventArgs.Empty);
            }
        }
Ejemplo n.º 3
0
        private void RespCallback(IAsyncResult iar)
        {
            Requests request = (Requests)iar.AsyncState;

            string page;
            bool   endGetResponse = request.EndGetResponse(iar, out page);

            lock (_locker)
            {
                if (endGetResponse)
                {
                    _parser.TryParse(page, request.Id);
                }
                else
                {
                    _badIds.Enqueue(request.Id);
                }
            }
            request.Dispose();
            _semaphore.Release();

            if (endGetResponse && PageDownloadingComplete != null)
            {
                PageDownloadingComplete(null, EventArgs.Empty);
            }
        }