I am trying to update a WPF textblock from within a Parallel.For and I can't. I use a dispatcher but I guess, I do it the wrong way. All of the work is done at first and then the textblock updates iteratively and fast. Here's my code:
Parallel.For(0, currentScene.Textures.Count, delegate(int i)
{
TextureObject texture = (currentScene.Textures[i]);
MainWindow.Instance.StatusBarText.Dispatcher.BeginInvoke(new Action(()
=> MainWindow.Instance.StatusBarText.Text = "Loading Texture " + i
+ " - " + texture.Name ), null);
LoadTexture(texture);
}
});