画像を表示するWPFコントロールを作成しました。今、私はその画像を非常に速い速度で変更したいと思います。画像を保持し、変更されたときにコントロール内の画像を更新するChangedEventHandlerを持つImageContainerクラスを作成しました。
実行されるコードは次のようになります。
videoImageThread = new Thread(
new ThreadStart(
delegate()
{
this.VideoCapture.Dispatcher.Invoke(
System.Windows.Threading.DispatcherPriority.Normal,
new Action(
delegate()
{
videoImage.Source = VideoImageContainer.Instance.VideoBitmapSourceImage;
}
));
}
));
private void Instance_VideoRefresh()
{
if (VideoImageContainer.Instance.VideoImage != null)
{
lock (videoImageSetLock)
{
videoImageThread.Start();
}
}
}
このコードはSystem.Reflection.TargetInvocationExceptionをスローしますが、何が間違っていますか?