public void setSimulationControlStateCallbackMethod(SimulationControlState state) { if (state.isRunning) { runBtn.Enabled = false; stopBtn.Enabled = true; } else { runBtn.Enabled = true; stopBtn.Enabled = false; } double progressToShow = state.progress; if (progressToShow > 1) { progressToShow = 1; } else if (progressToShow < 0) { progressToShow = 0; } progressBar1.Value = (int)(progressToShow * 100); //this.Refresh(); }
public void setSimulationControlState(SimulationControlState state) { if (this.InvokeRequired) { this.Invoke(new SetSimulationControlStateCallBack(this.setSimulationControlStateCallbackMethod),state); } else { setSimulationControlStateCallbackMethod(state); } }