Exemple #1
0
        /// <summary>
        /// function for execution thread in animate simulation mode
        /// </summary>
        private void ExecuteStepIn()
        {
            this.mowayModel.StartSimulation();
            SimPointer next = this.SimulateAction(this.presentFunction, this.presentElement);

            if (next == null)   //The end of the simulation has been reached
            {
                //The Simulator status is updated
                this.state = SimState.Stop;
                if (this.StateChanged != null)
                {
                    this.StateChanged(this, new EventArgs());
                }
                this.mowayModel.PauseSimulation();
                if (this.SimulationFinished != null)
                {
                    this.SimulationFinished(this, new EventArgs());
                }
            }
            else
            {
                //The simulation indicator is displayed and updated
                this.UpdateTrace(next.Function, next.Element);
                //The Simulator status is updated
                this.state = SimState.Pause;
                if (this.StateChanged != null)
                {
                    this.StateChanged(this, new EventArgs());
                }
                this.mowayModel.PauseSimulation();
            }
        }
Exemple #2
0
 /// <summary>
 /// function for the normal execution thread of the simulation
 /// </summary>
 private void ExecuteRun()
 {
     this.mowayModel.StartSimulation();
     //As long as the simulation does not stop
     while (true)
     {
         if (this.stopSimulate)
         {
             this.graphTrace.Visible = true;
             this.UpdateTrace(this.tempFunction, this.presentElement);
             this.state = SimState.Pause;
             if (this.StateChanged != null)
             {
                 this.StateChanged(this, new EventArgs());
             }
             this.mowayModel.PauseSimulation();
             break;
         }
         SimPointer next = this.SimulateAction(this.tempFunction, this.presentElement);
         if (next == null)   //The end of the simulation has been reached
         {
             //The end of the simulation has been reached
             this.graphTrace.Visible = true;
             this.UpdateTrace(this.tempFunction, this.presentElement);
             //The Simulator status is updated
             this.state = SimState.Stop;
             if (this.StateChanged != null)
             {
                 this.StateChanged(this, new EventArgs());
             }
             this.mowayModel.PauseSimulation();
             if (this.SimulationFinished != null)
             {
                 this.SimulationFinished(this, new EventArgs());
             }
             break;
         }
         else
         {
             this.tempFunction   = next.Function;
             this.presentElement = next.Element;
         }
         System.Threading.Thread.Sleep(10);
     }
 }
Exemple #3
0
 /// <summary>
 /// function for execution thread in animate simulation mode
 /// </summary>
 private void ExecuteAnimate()
 {
     this.mowayModel.StartSimulation();
     //As long as the simulation does not stop
     while (true)
     {
         if (this.stopSimulate)
         {
             this.state = SimState.Pause;
             if (this.StateChanged != null)
             {
                 this.StateChanged(this, new EventArgs());
             }
             this.mowayModel.PauseSimulation();
             break;
         }
         SimPointer next = this.SimulateAction(this.presentFunction, this.presentElement);
         if (next == null)   //The end of the simulation has been reached
         {
             //The simulation indicator is displayed and updated
             this.UpdateTrace(this.presentFunction, this.presentElement);
             //The Simulator status is updated
             this.state = SimState.Stop;
             if (this.StateChanged != null)
             {
                 this.StateChanged(this, new EventArgs());
             }
             this.mowayModel.PauseSimulation();
             if (this.SimulationFinished != null)
             {
                 this.SimulationFinished(this, new EventArgs());
             }
             break;
         }
         else
         {
             this.UpdateTrace(next.Function, next.Element);
         }
         //The model is indicated that the simulation should be paused in the intermediate time between each of the actions to simulate
         this.mowayModel.PauseSimulation();
         System.Threading.Thread.Sleep(500);
         this.mowayModel.StartSimulation();
     }
 }
Exemple #4
0
        /// <summary>
        /// function for simulation execution thread StepOver
        /// </summary>
        private void ExecuteStepOver()
        {
            this.mowayModel.StartSimulation();
            int stackLevel = this.functionCallstack.Count;

            //As long as the simulation does not stop
            while (true)
            {
                if (this.stopSimulate)
                {
                    this.UpdateTrace(this.tempFunction, this.presentElement);
                    this.state = SimState.Pause;
                    if (this.StateChanged != null)
                    {
                        this.StateChanged(this, new EventArgs());
                    }
                    this.mowayModel.PauseSimulation();
                    break;
                }
                SimPointer next = this.SimulateAction(this.tempFunction, this.presentElement);
                if (next == null)   //The end of the simulation has been reached
                {
                    //The simulation indicator is displayed and updated
                    this.UpdateTrace(this.tempFunction, this.presentElement);
                    //The Simulator status is updated
                    this.state = SimState.Stop;
                    if (this.StateChanged != null)
                    {
                        this.StateChanged(this, new EventArgs());
                    }
                    this.mowayModel.PauseSimulation();
                    if (this.SimulationFinished != null)
                    {
                        this.SimulationFinished(this, new EventArgs());
                    }
                    break;
                }
                else
                {
                    //If there are the same items in the function return stack you have finished the StepOver
                    if (this.functionCallstack.Count == stackLevel)
                    {
                        //The simulation indicator is displayed and updated
                        this.UpdateTrace(this.presentFunction, next.Element);
                        //The Simulator status is updated
                        this.state = SimState.Pause;
                        if (this.StateChanged != null)
                        {
                            this.StateChanged(this, new EventArgs());
                        }
                        this.mowayModel.PauseSimulation();
                        break;
                    }
                    else
                    {
                        this.tempFunction   = next.Function;
                        this.presentElement = next.Element;
                    }
                }
            }
            System.Threading.Thread.Sleep(10);
        }