Example #1
0
 public void StopSimulation()
 {
     if (!IsSimulating)
     {
         return;
     }
     lock (simulationControlLock)
     {
         if (!IsSimulating)
         {
             return;
         }
         cancellationTokenSource?.Cancel();
         SimulationTask?.Wait();
         IsSimulating = false;
     }
 }
Example #2
0
 public void StopSimulation()
 {
     if (!IsSimulating)
     {
         return;
     }
     lock (simulationControlLock)
     {
         if (!IsSimulating)
         {
             return;
         }
         cancellationTokenSource?.Cancel();
         try
         {
             SimulationTask?.Wait();
         }
         catch (AggregateException e)
         {
         }
         IsSimulating = false;
     }
 }