Parallel.For 内から WPF テキストブロックを更新しようとしていますが、できません。私はディスパッチャーを使用していますが、間違った方法で行っていると思います。最初にすべての作業が完了し、次にテキストブロックが反復的かつ高速に更新されます。これが私のコードです:
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);
}
});