I am showing animation while my control is loading data. When the stream ends, I hide the animation and show the control. Therefore, I am executing this code from a thread:
protected void InvokeEnableBackControl() { if (this.InvokeRequired) { this.Invoke(new OpHandler(EnableBackControl)); } else { EnableBackControl(); } }
Sometimes, when I execute this code, the main thread gets stuck in the following code:
protected virtual void EnableBackControl() { if (overlayAnimation.TargetControl != null) { overlayAnimation.TargetControl.BringToFront(); } overlayAnimation.SendToBack(); overlayAnimation.Enabled = false; overlayAnimation.Visible = false;
}
I'm not sure if he hung up the Enable or Visible parameter. Do you know any circumstances that an application that calls these properties can pass with Control.Invoke ?
Daniel Peñalba
source share