我的代码:
//Array with number of files
string[] A = Directory.GetFiles("C:\\Users\\ggg\\AppData\\Local\\Google\\Chrome\\User Data\\Default", "*.*", SearchOption.AllDirectories);
for (int i = 0; i < A.Length; i++)
{
Label files = ((MainWindow)System.Windows.Application.Current.MainWindow)._pnlScanResults.FindName("lblFiles") as Label;
files.Content = cGlobal.filesArray[i].ToString();
//need some time to see file name one by one on label.....how ??
}
答案 0 :(得分:1)
Lbl
是显示文件名的Label
。
System.Threading.Tasks.Task.Factory.StartNew(() =>
{
for (int i = 0; i < A.Length - 1; i++)
{
System.Threading.Thread.Sleep(1000);
Lbl.Dispatcher.Invoke(() => { Lbl.Content = i + " : " + A[i]; });
}
});