I created a list of strings with .txt files and then checked if the files exist.
On top of that I want the tag to show the files the foreach is going through.
Tried thread.Sleep but the whole app freezes. I am in WPF and the following code I use.
private void Button_Click(object sender, RoutedEventArgs e)
{
List<string> test = new List<string>();
test.Add(@"Files\file1.txt"); test.Add(@"Files\file2.txt"); test.Add(@"Files\file3.txt");
foreach(string t in test)
{
Label2.Content = t;
System.Threading.Thread.Sleep(1000);
if (File.Exists(t))
{
Label2.Content = "yea!";
}
}
}