Beispiel #1
0
        void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            RenameWorker worker = (RenameWorker)e.Result;

            // go to the renamd directory or fire events
            if (worker.ChangeDirectorynames)
            {
                if (worker.rootDirectory != "" && Directory.Exists((worker.rootDirectory)))
                {
                    this.FireDirectoryNameChanged(worker.rootDirectory);
                }
                else
                {
                    this.FireDirectoryChanged(true);
                }
            }
            else
            {
                this.FireDirectoryChanged(false);
            }

            FireDataChanged();

            mainForm.WorkFinished();
        }
Beispiel #2
0
        void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            RenameWorkerArgument workerArgs = (RenameWorkerArgument)e.Argument;

            RenameModel      model            = workerArgs.model;
            BackgroundWorker backgroundWorker = (BackgroundWorker)sender;

            backgroundWorker.ReportProgress(0);

            // create worker
            RenameWorker worker = new RenameWorker();

            worker.currentPicture = this.currentPicture;
            worker.rootDirectory  = this.currentDirectory;
            worker.SetFileList(workerArgs.filenames);
            worker.OneFileProcessed += delegate(object s, ProgressChangedEventArgs args) { backgroundWorker.ReportProgress(args.ProgressPercentage); };

            // start working
            worker.ProcessFiles(model);

            worker.ChangeDirectorynames = model.ChangeDirectorynames;
            e.Result = worker;
        }