private void btnArchive_Click(object sender, RoutedEventArgs e) { DirTool dir = new DirTool(); _dirs = dir.GetAllSubDirectories(txtDirName.Text); int i = 0; foreach (string dirName in _dirs) { if (dir.IsPicturesFolder(dirName)) { i++; } } progBar.Minimum = 0; progBar.Maximum = i; this.btnArchive.IsEnabled = false; this.btnBrowse.IsEnabled = false; _backgroundWorker.RunWorkerAsync(this); }
private void Worker_DoWork(object sender, DoWorkEventArgs e) { int i = 0; DirTool dir = new DirTool(); foreach (string dirName in _dirs) { if (dir.IsPicturesFolder(dirName)) { dir.createZip(dirName); i++; _backgroundWorker.ReportProgress(i); } } }