private void ScanFolders(string path)
{
UpdateProgressBarDelegate updateProgressBar1 = new UpdateProgressBarDelegate(progressBar1.SetValue);
string[] folders;
folders = Directory.GetDirectories(path);
var val = progressBar1.Value;
progressBar1.Minimum = 0;
progressBar1.Value = 0;
progressBar1.Maximum = folders.Count();
for (double j=0; j < folders.Count(); j++)
{
textBlock1.Text = folders[(int)j];
Dispatcher.Invoke(updateProgressBar1, System.Windows.Threading.DispatcherPriority.Background, new object[] { ProgressBar.ValueProperty, j });
ScanFolders(textBlock1.Text);
}
progressBar1.Value = progressBar1.Maximum;
}
This is the central function of my small app; is this enough?