/// <summary> /// Stopping the calculation if still in progress /// </summary> /// <remarks> /// This is typically to be called when there have been changes /// made in the model resulting in changes to the element being analyzed. /// </remarks> /// public void StopCalculation() { // We first signal we do not want more results, // so the work-thread knows to stop if it is still around. m_results.SetCompleted(); // If the thread is alive, we'll wait for it to finish // It will not take longer than one calculation cycle. if (m_threadAgent != null) { if (m_threadAgent.IsThreadAlive) { m_threadAgent.WaitToFinish(); } m_threadAgent = null; } }