Ejemplo n.º 1
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            ListViewObject[] lvos = (ListViewObject[])e.Argument;
            int job = 1;

            foreach (ListViewObject lvo in lvos)
            {
                ProgressReport report = new ProgressReport();
                report.msg        = string.Format("Job {0}: Analysing...", job);
                report.numChanges = 0;
                report.step       = false;
                backgroundWorker1.ReportProgress(0, report);


                BackupUtility.AnalysisResults ar = Utilities.Analyze(lvo.Source, lvo.Destination);

                report.msg        = null;
                report.numChanges = ar.Count;
                backgroundWorker1.ReportProgress(0, report);
                report.step       = true;
                report.numChanges = 0;
                for (int i = 0; i < ar.Count; i++)
                {
                    if (backgroundWorker1.CancellationPending)
                    {
                        return;
                    }
                    report.msg = "..." + ar.getRelativeFile(i) + " " + calcFileSize(ar.getOriginalFile(i));
                    backgroundWorker1.ReportProgress(0, report);
                    Utilities.BackupNext(ar);
                }
                job++;
            }
        }