private static void WriteIt(IExecutive exec, object userData) { Console.WriteLine("{0} : A tick happened on the metronome", exec.Now); if (exec.Now.Hour == 13) { Console.WriteLine("\tIt is {0} - pausing the simulation (just for 5 seconds.)", exec.Now); exec.Pause(); // This could be called via a GUI action. Thread.Sleep(5000); Console.WriteLine("\tWe're resuming the simulation."); exec.Resume(); // This could be called via a GUI action. } }
private void PauseAndResumeExec(object obj) { System.Threading.Thread.Sleep(1000); IExecutive exec = (IExecutive)obj; Debug.WriteLine("\r\n" + "Pausing for two seconds..." + "\r\n"); Debug.WriteLine("Before pause, Exec state is " + exec.State); exec.Pause(); System.Threading.Thread.Sleep(2000); Debug.WriteLine("After pause, Exec state is " + exec.State); Debug.WriteLine("\r\n" + "Resuming..." + "\r\n"); exec.Resume(); Debug.WriteLine("Exec state is now " + exec.State); }
/// <summary> /// Pauses execution of this model after completion of the running callback of the current event. /// </summary> public virtual void Pause() { if (s_diagnostics) { _Debug.WriteLine("Model.Pause() requested."); } if (IsRunning) { IsRunning = true; IsReady = false; IsPaused = true; IsCompleted = false; } Exec.Pause(); }