I have an application that receives and displays live video feed (Motion JPEG). I have a tree view so the user can select which live video feed to view. Originally the feed was displayed in an image box on my main form. It was decided that the feed should be displayed in a pop up window. This is where I have my problems.
I process the video feed in a worker thread and that is working fine. When my thread and image box were on the main form, in my worker I had the line:
mCameraView.Image = lastFrame;
This was updating just fine.
Now that I've moved the thread and image box to a seperate form, this code works, but if I move or resize the dialog it crashes. I was told that this may be due to the fact that I'm trying to access the UI from two different threads; myWorker and the original.
My solution was to save the image to a local variable instead of updating the UI directly
Call invalidate on the ImageBox
In the OnPaint update the ImageBox with the image.
Now my program is just freezing. I assume it is deadlocking somehow. Anyone know what is going on? Or if there is a better solution?