I have an application in which I am doing something very similar with Threading. This code should update your data one line at a time while the code is running.
using System.Windows.Threading;
private void Run()
{
try
{
var t = new Thread(Read) { IsBackground = true };
t.Start();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void Read()
{
foreach ()
{
var sr = new ResultClass()
Dispatcher.BeginInvoke(DispatcherPriority.Normal,
(ThreadStart)(() => dgResults.AddItem(sr)));
}
}
source
share