これは私の例外です
The calling thread cannot access this object because a different thread owns it.
私の関数は計算から結果を取得し、すでに開いているウィンドウを更新したい..
public override void UpdateResult(BaseMetricResults result)
{
var newResults = result as MetricUniformityResults;
if (newResults == null)
{
return;
}
DispatcherHelper.UIDispatcher.Invoke(() =>
{
TopToBottomGraph.CrossSectionPoints.Clear();
foreach (var point in newResults.TopToBottomGraph.CrossSectionPoints)
{
TopToBottomGraph.CrossSectionPoints.Add(point);
}
newResults.JetMap.Freeze(); //exception here
byte[] arr = new byte[(int) (newResults.JetMap.Width*newResults.JetMap.Height*3)];
newResults.JetMap.CopyPixels(arr, (int) (newResults.JetMap.Width*3), 0);
JetMap = BitmapSource.Create((int) newResults.JetMap.Width, (int) newResults.JetMap.Height, 96, 96,
PixelFormats.Rgb24, BitmapPalettes.WebPalette, arr,
(int) (newResults.JetMap.Width*3));
});
}
これは私の最後の試みです。bitmapsource をフリーズする必要があるかどうかはわかりません...
とにかく newResults.JetMap は BitmapSource であり、新しい BitmapSource である JetMap という名前のプロパティがあります。古いイメージを更新するにはどうすればよいですか?新しい方?