c# - TargetInvocationException on Image update in WPF -
I created a WPF control that displays an image. Now I want to change that image at a very fast rate. I created an ImageContainer class that contains the image and when a ChangedEventHandler is changed which updates the image in my control
the code that looks like this Is executed.
videoImageThread = new thread (new thread (representative () {this.VideoCapture.Dispatcher.Invoke (System.Windows.Threading.DispatcherPriority.Normal, new action (representative () {videoImage.Source = VideoImageContainer.Instance.VideoBitmapSourceImage;}));})); Private Zero Instance_VideoRefresh () {if (VideoImageContainer.Instance.VideoImage = Null!) {Lock (videoImageSetLock) {videoImageThread.Start (); }}}
This code throws a System.Reflection.TargetInvocationException, what am I doing wrong?
I think
So you tried to apply the action on the sender directly like:?!
Private Zero instance_VideoRefresh () {if (VideoImageContainer.Instance.VideoImage! = Tap) this.VideoCapture.Dispatcher.Invoke (System.Windows.Threading.DispatcherPriority.Normal, New Action (Rep. ) {VideoImage.Source = Video Image Container.Instance.VideoBitmap Source Image;})); }
Comments
Post a Comment