I have been working with WPF and threading.
I would like to pause the whole screen (the application only) during a for loop.
E.g.
foreach (classA a in classesA)
{
....
....
Thread.sleep(100);
}
However, I found that it will sleep for long and then execute all the statement in a time. It is not what I want. I want to sleep within the execution of the for loop. That is to sleep 100ms after 1st loop, then sleep again after the 2nd loop.....
I found that some article mentioned DoEvents(), but I am not quite familiar with it and WPF seem don't have this kind of thing.
Some other articles mentioned DispatcherTimer. Still, it will not lock the screen. I would like to lock the whole screen (the application only) to prevent from clicking any button during the execution of the for loop.
How could I do so?
Thank you so much!