private void Cleanup(bool disposing) { if (disposing) { if (_generateThumbnailsWorker != null) { _generateThumbnailsWorker.Stop(); _generateThumbnailsWorker.PostPageProcessed -= new EventHandler <Workers.ThreadedPageWorkerPageProcessedEventArgs>(_generateThumbnailsWorker_PostPageProcessed); _generateThumbnailsWorker.PrePageProcessed -= new EventHandler <Workers.ThreadedPageWorkerPageProcessedEventArgs>(_generateThumbnailsWorker_PrePageProcessed); _generateThumbnailsWorker.ProcessFinished -= new EventHandler <EventArgs>(_generateThumbnailsWorker_ProcessFinished); _generateThumbnailsWorker.Dispose(); _generateThumbnailsWorker = null; } } }
public PagesControl() { InitializeComponent(); // Use GDI+ paint RasterPaintProperties props = _rasterImageList.PaintProperties; props.PaintEngine = RasterPaintEngine.GdiPlus; _rasterImageList.PaintProperties = props; _thumbnailsToolStripButton.Checked = true; _bookmarksToolStripButton.Checked = false; _signaturesToolStripButton.Checked = false; // This object generates the thumbnails for the pages in a separate thread _generateThumbnailsWorker = new Workers.GenerateThumbnailsWorker(); _generateThumbnailsWorker.PrePageProcessed += new EventHandler <Workers.ThreadedPageWorkerPageProcessedEventArgs>(_generateThumbnailsWorker_PrePageProcessed); _generateThumbnailsWorker.PostPageProcessed += new EventHandler <Workers.ThreadedPageWorkerPageProcessedEventArgs>(_generateThumbnailsWorker_PostPageProcessed); _generateThumbnailsWorker.ProcessFinished += new EventHandler <EventArgs>(_generateThumbnailsWorker_ProcessFinished); UpdateUIState(); }