private void OnModelStateChanged(object sender, EventArgs e) { ModelStateChanged?.Invoke(sender, e); UpdateSimulationButtonVisibilities(); if (Simulator.IsCompleted) { EndOfCounterExample.Visibility = Visibility.Visible; } else { EndOfCounterExample.Visibility = Visibility.Hidden; } }
/// <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); }
/// <summary> /// Prunes all states lying in the future after a rewind. /// </summary> public void Prune() { _simulator.Prune(); ModelStateChanged?.Invoke(this, EventArgs.Empty); }
/// <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); }
/// <summary> /// Executes the next step of the simulation. /// </summary> private void ExecuteStep() { _simulator.SimulateStep(); ModelStateChanged?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Pauses the simulation. /// </summary> public void Pause() { _timer?.Dispose(); _timer = null; ModelStateChanged?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Resets the simulation to its initial state. /// </summary> public void Reset() { _simulator.Reset(); ModelStateChanged?.Invoke(this, EventArgs.Empty); }
// Event Raisers protected virtual void OnModelStateChanged() { ModelStateChanged?.Invoke(model.DataModelState); }