Пример #1
0
        private void OnModelStateChanged(object sender, EventArgs e)
        {
            ModelStateChanged?.Invoke(sender, e);
            UpdateSimulationButtonVisibilities();

            if (Simulator.IsCompleted)
            {
                EndOfCounterExample.Visibility = Visibility.Visible;
            }
            else
            {
                EndOfCounterExample.Visibility = Visibility.Hidden;
            }
        }
Пример #2
0
 /// <summary>
 ///   Rewinds the simulator by the given number of <paramref name="steps" />, if possible.
 /// </summary>
 /// <param name="steps">The number of steps that should be rewound.</param>
 public void Rewind(int steps)
 {
     _simulator.Rewind(steps);
     ModelStateChanged?.Invoke(this, EventArgs.Empty);
 }
Пример #3
0
 /// <summary>
 ///   Prunes all states lying in the future after a rewind.
 /// </summary>
 public void Prune()
 {
     _simulator.Prune();
     ModelStateChanged?.Invoke(this, EventArgs.Empty);
 }
Пример #4
0
 /// <summary>
 ///   Advances the simulator by the given number of <paramref name="steps" />, if possible.
 /// </summary>
 /// <param name="steps">The number of steps the simulation should be advanced.</param>
 public void FastForward(int steps)
 {
     _simulator.FastForward(steps);
     ModelStateChanged?.Invoke(this, EventArgs.Empty);
 }
Пример #5
0
 /// <summary>
 ///   Executes the next step of the simulation.
 /// </summary>
 private void ExecuteStep()
 {
     _simulator.SimulateStep();
     ModelStateChanged?.Invoke(this, EventArgs.Empty);
 }
Пример #6
0
 /// <summary>
 ///   Pauses the simulation.
 /// </summary>
 public void Pause()
 {
     _timer?.Dispose();
     _timer = null;
     ModelStateChanged?.Invoke(this, EventArgs.Empty);
 }
Пример #7
0
 /// <summary>
 ///   Resets the simulation to its initial state.
 /// </summary>
 public void Reset()
 {
     _simulator.Reset();
     ModelStateChanged?.Invoke(this, EventArgs.Empty);
 }
Пример #8
0
 // Event Raisers
 protected virtual void OnModelStateChanged()
 {
     ModelStateChanged?.Invoke(model.DataModelState);
 }