protected void StopAnimation() { if (aThread == null) { return; } if (buttonRenderAnim.InvokeRequired) { StopAnimationCallback ea = new StopAnimationCallback(StopAnimation); BeginInvoke(ea); } else { // actually stop the animation: lock ( progress ) { progress.Continue = false; } aThread.Join(); aThread = null; // Dispose unwritten queued results: initQueue(0); semQueue = null; semResults = null; // GUI stuff: EnableGUI(true); } }
protected void StopAnimation() { if (aThread == null) { return; } if (buttonRenderAnim.InvokeRequired) { StopAnimationCallback ea = new StopAnimationCallback(StopAnimation); BeginInvoke(ea); } else { // actually stop the animation: lock ( progress ) { progress.Continue = false; } aThread.Join(); aThread = null; // GUI stuff: SetGui(true); } }