void TaskCompleted(RunWorkerCompletedEventArgs e) { lblStatus1.Text = "Preparing results..."; lblStatus2.Text = ""; lblStatus3.Text = ""; lblStatus4.Text = ""; lblStatus5.Text = ""; this.Text = "Please wait..."; progressBar1.Visible = false; btnCancel.Visible = false; progressBar1.Text = ""; progressBar1.ShowPercentage = false; this.Refresh(); if (TypeOfWork == 3) //dupe search { SearchCompleted(Results); if (DupesFound == 0) { lblStatus1.Text = "No duplicate files were found. Please try modifying the search criteria."; } else { lblStatus1.Text = DupesFound.ToString("###,###,##0") + " Duplicate files found, " + general.SexySize((long)SpaceSaveable) + " of space recoverable."; } lblStatus2.Text = "Total files searched: " + TotalSearched.ToString("###,###,##0"); if (NumExcluded > 0) { lblStatus4.Text = "Folders excluded: " + NumExcluded.ToString(); } if (Errors.Count > 0) { lblStatus3.Text = "Errors: " + Errors.Count.ToString(); } } else { UpdateResults(TypeOfWork, Destination.Substring(0, Destination.Length - 1)); lblStatus1.Text = successful.ToString("###,###,##0") + " files were successfully "; if (TypeOfWork == 0) { lblStatus1.Text = lblStatus1.Text + "deleted."; lblStatus2.Text = general.SexySize(SpaceSaved) + " disk space recovered."; } else if (TypeOfWork == 1) { lblStatus1.Text = lblStatus1.Text + "copied."; } else if (TypeOfWork == 2) { lblStatus1.Text = lblStatus1.Text + "moved."; } if (failed > 0) { lblStatus2.Text += failed.ToString() + " files failed."; } } progressBar1.Visible = true; //progressBar1.Style = ProgressBarStyle.Continuous; if (progressBar1.Maximum == 0) { progressBar1.Maximum = 1; //so that we at least show a full green bar even if 0 files were scanned } progressBar1.Value = progressBar1.Maximum; timer1.Enabled = false; if (failed > 0 || Errors.Count > 0) { btnViewErrors.Visible = true; } btnCancel.Text = "&OK"; btnCancel.Visible = true; System.Media.SystemSounds.Beep.Play(); if (!e.Cancelled) { this.Text = "Operation complete"; } else { progressBar1.BorderColor = Color.LightCoral; progressBar1.ProgressColor = Color.Orange; this.Text = "Operation interrupted"; } }
private void bwDupeFinder_ProgressChanged(object sender, ProgressChangedEventArgs e) { if (CurrentState == Building_FileList) { ShowProgress("Building file list... ", "Files found: " + BuildingCounter.ToString("###,###,##0"), 0); } else if (CurrentState == PERFORMING_CALCULATIONS) { ShowProgress("Determining file sizes...", "Files found: " + BuildingCounter.ToString("###,###,##0"), 0); } else { if (e.ProgressPercentage == 0) { progressBar1.ShowPercentage = true; progressBar1.Text = ""; progressBar1.Maximum = mainFileList.Count(); } if (Errors.Count > 0) { ShowProgress("Location: " + currentlyWorkingPath, "Duplicates found: " + DupesFound.ToString("###,###,##0") + " (" + general.SexySize((long)SpaceSaveable) + ")", e.ProgressPercentage, "", "Files searched: " + TotalSearched.ToString("###,###,##0"), "Errors: " + Errors.Count.ToString()); } else { ShowProgress("Location: " + currentlyWorkingPath, "Duplicates found: " + DupesFound.ToString("###,###,##0") + " (" + general.SexySize((long)SpaceSaveable) + ")", e.ProgressPercentage, "", "Files searched: " + TotalSearched.ToString("###,###,##0")); } } }