Exemplo n.º 1
0
        public FileNodes(Config config, Screensaver screensaver)
        {
            this.config       = config;
            this.screensaver  = screensaver;
            this.fileDatabase = new FileDatabase(this.screensaver.readOnly);
            //this.fileDatabase.MetadataReadEvent += new MetadataReadEventHandler(metadataShow);

            if (screensaver.action != Screensaver.Actions.Wallpaper)
            {
                this.resetFoldersQueue();

                this.backgroundWorker = new System.ComponentModel.BackgroundWorker();
                this.backgroundWorker.WorkerReportsProgress      = true;
                this.backgroundWorker.WorkerSupportsCancellation = true;
                this.backgroundWorker.DoWork             += new DoWorkEventHandler(DoWorkImageFolder);
                this.backgroundWorker.ProgressChanged    += new ProgressChangedEventHandler(progressChanged);
                this.backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(runWorkerCompleted);

                // Use local folders as this.folders is used in backgroundWorker
                //var folders = Utils.stringToConcurrentQueue(Convert.ToString(this.config.getPersistant("folders")));
                // Purge database in main thread rather, to avoid having to run database filter twice
                this.purgeNotMatchingParentFolders(this.folders);

                this.backgroundWorker.RunWorkerAsync();
            }
        }
        public FileNodes(Config config, Screensaver screensaver)
        {
            this.config = config;
            this.screensaver = screensaver;
            this.fileDatabase = new FileDatabase(this.screensaver.readOnly);
            //this.fileDatabase.MetadataReadEvent += new MetadataReadEventHandler(metadataShow);

            if (screensaver.action != Screensaver.Actions.Wallpaper) {

                this.resetFoldersQueue();

                this.backgroundWorker = new System.ComponentModel.BackgroundWorker();
                this.backgroundWorker.WorkerReportsProgress = true;
                this.backgroundWorker.WorkerSupportsCancellation = true;
                this.backgroundWorker.DoWork += new DoWorkEventHandler(DoWorkImageFolder);
                this.backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(progressChanged);
                this.backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(runWorkerCompleted);

                // Use local folders as this.folders is used in backgroundWorker
                //var folders = Utils.stringToConcurrentQueue(Convert.ToString(this.config.getPersistant("folders")));
                // Purge database in main thread rather, to avoid having to run database filter twice
                this.purgeNotMatchingParentFolders(this.folders);

                this.backgroundWorker.RunWorkerAsync();
            }
        }