I'm doing a long loop checking for the content of a folder, split in three part.
p1 - This folder have more than 5000 folders in it,
p2 - which have ~10 folders each,
p3 - then an unknow number of files/folders for each.
I've made a progress bar with the maximum value = p1.nbFolder at the end of each p1.folder i increase the progressbar.Value by one. but the window freeze and the only things working to refresh the windows at the end of each folder, is a MessageBox.Show(" ");
this.UpdateLayout(); isn't working
Thread.Sleep(0); neither
for (int inc = 0; inc < postes.Items.Count; inc++) {
poste = (TreeViewItem)postes.Items[inc];
poste.IsSelected = true;
tranches = (TreeViewItem)tr_tranche.Items[0];
for (int incb = 0; incb < tranches.Items.Count; incb++) {
tranche = (TreeViewItem)tranches.Items[incb];
tranche.IsSelected = true;
StackPanel SPposte = (StackPanel)poste.Header;
Label Lposte = (Label)SPposte.Children[1];
String Sposte = (String)Lposte.Content;
StackPanel SPtranche = (StackPanel)tranche.Header;
Label Ltranche = (Label)SPtranche.Children[1];
String Stranche = (String)Ltranche.Content;
//str.Append("Poste : " + Sposte + " | Tranche : " + Stranche + " | indice : " + incb + " \n");
if (tranche != null) {
StackPanel stack = (StackPanel)tranche.Header;
Label lbl = (Label)stack.Children[1];
String nom = lbl.Content.ToString();
tr_folio.Items.Clear();
_folio = getDossier(nom, _tranche);
//ne filtre rien
_folio.getDossiers("a*");
_folio.getFichiers();
tr_folio.Items.Add(Utils.TreeUtils.ContenuDossier(_folio));
lbl_source.Content = _folio.Chemin;
TreeViewItem entete = (TreeViewItem)tr_folio.Items[0];
entete.IsExpanded = true;
}
//MessageBox.Show(incb.ToString());
tranche.IsSelected = false;
}
poste.IsSelected = false;
pgrB.Value++;
Thread.Sleep(1);
this.UpdateLayout();