public Scraper()
 {
     ProgressService.RegisterPublisher(this);
     Worker.WorkerSupportsCancellation = true;
     Worker.DoWork               += Worker_DoWork;
     Worker.ProgressChanged      += Worker_ProgressChanged;
     Worker.RunWorkerCompleted   += Worker_RunWorkerCompleted;
     Worker.WorkerReportsProgress = true;
     ProgressArgs = new ProgressWindowEventArgs();
 }
Exemple #2
0
 public Importer(SourceDirectory source)
 {
     _excludedDomain = new ExcludedDomain();
     ProgressService.RegisterPublisher(this);
     _source                           = source;
     _source.Books                     = new HashSet <Book>();
     _foundPdfFiles                    = new List <string>();
     Worker                            = new BackgroundWorker();
     Worker.DoWork                    += _worker_DoWork;
     Worker.ProgressChanged           += _worker_ProgressChanged;
     Worker.RunWorkerCompleted        += _worker_RunWorkerCompleted;
     Worker.WorkerReportsProgress      = true;
     Worker.WorkerSupportsCancellation = true;
     ProgressArgs                      = new ProgressWindowEventArgs();
     _booksImported                    = 0;
     _booksExisted                     = 0;
     _booksExcluded                    = 0;
 }
Exemple #3
0
        public Importer(IBookRepository bookRepository, ISourceRepository sourceRepository)
        {
            _sourcerepo    = sourceRepository;
            _bookService   = new BookService(bookRepository);
            _sourceService = new SourceService(sourceRepository);
            ProgressService.RegisterPublisher(this);
            Worker = new BackgroundWorker
            {
                WorkerReportsProgress      = true,
                WorkerSupportsCancellation = true
            };
            Worker.DoWork             += Worker_DoWork;
            Worker.RunWorkerCompleted += Worker_RunWorkerCompleted;
            Worker.ProgressChanged    += Worker_ProgressChanged;

            WorkerCleanup = new BackgroundWorker
            {
                WorkerReportsProgress      = true,
                WorkerSupportsCancellation = true
            };
            WorkerCleanup.DoWork             += WorkerCleanup_DoWork;
            WorkerCleanup.RunWorkerCompleted += WorkerCleanup_RunWorkerCompleted;
            WorkerCleanup.ProgressChanged    += WorkerCleanup_ProgressChanged;
        }