Deleted post and have code:
namespace StackOverflowQuestion
{
class Program
{
static void Main (string[] args)
{
var cw = new ConsoleWriter ();
for (int i = 0; i <= 5000000; i++)
{
cw.Write (i);
}
Console.ReadKey ();
}
}
class ConsoleWriter
{
private Stopwatch sw = new Stopwatch ();
public ConsoleWriter ()
{
sw.Start ();
}
public void Write (int pNumber)
{
if (sw.ElapsedMilliseconds >= 50)
{
Console.WriteLine (pNumber);
sw.Restart ();
}
}
}
}
And the output:
305940
651171
1002965
1358665
1715740
2069602
2419054
2772833
3127880
3485054
3844335
4204016
4557912
4913494
So everything works fine. In this example ConsoleWriter display number on console, but it could be displayed in Control surface. Like you see, even if I call 5000000 times Write method, it only updates UI after minimum 50 ms. Great, but notice in many cases the last value 5000000 will not be displayed. How to fix it? Should I use a class (thread) which will call event each 50 ms and it will check the value to write is changed?