I have this method to draw overlay:
void DrawOverlay(ImageViewerAddOn addOn, DateTime timestamp)
{
if (addOn == null)
return;
if (System.Windows.Forms.Application.OpenForms.Count > 0)
{
if (System.Windows.Forms.Application.OpenForms[0].InvokeRequired)
{
System.Windows.Forms.Application.OpenForms[0].Invoke(new Action(() => DrawOverlay(addOn, timestamp)));
}
else
{
....
}
}
When I change the viewgroup or switch to playback, the client hangs on Invoke maybe 50% of the time. How can I prevent this?
System.Windows.Forms.Application.OpenForms[0].Invoke(new Action(() => DrawOverlay(addOn, timestamp)));