protected void StopComputation() { if (aThread == null) { return; } if (buttonRedraw.InvokeRequired) { StopComputationCallback ea = new StopComputationCallback(StopComputation); BeginInvoke(ea); } else { // actually stop the computation: cont = false; aThread.Join(); aThread = null; // GUI stuff: buttonRedraw.Enabled = true; buttonOpen.Enabled = true; buttonSave.Enabled = true; buttonStop.Enabled = false; } }
protected void StopComputation() { if (aThread == null) { return; } if (buttonOpen2.InvokeRequired) { StopComputationCallback ea = new StopComputationCallback(StopComputation); BeginInvoke(ea); } else { // actually stop the computation: cont = false; aThread.Join(); aThread = null; // GUI stuff: SetGUI(true); } }