Esempio n. 1
0
 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.
     }
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        /// <summary>
        /// Resumes execution of this model. Ignored if the model is not already paused.
        /// </summary>
        public virtual void Resume()
        {
            if (s_diagnostics)
            {
                _Debug.WriteLine("Model.Resume() requested.");
            }
            if (IsPaused)
            {
                IsRunning   = true;
                IsReady     = false;
                IsPaused    = false;
                IsCompleted = false;
            }

            Exec.Resume();
        }