private void nruMaxSpeed_ValueChanged(object sender, EventArgs e) { if (checkMinMax()) { oSimCon.setMaxSpeed((int)nruMaxSpeed.Value); } }
private void btnStart_Click(object sender, EventArgs e) { if (checkMinMax()) { oSimCon.Disconnect(); oSimCon = null; oSimCon = new Simcon(this); oSimCon.Connect(); oSimCon.setMinAlt((int)nruMinAlt.Value); oSimCon.setMaxAlt((int)nruMaxAlt.Value); oSimCon.setMinTime((int)nruMinTime.Value); oSimCon.setMaxTime((int)nruMaxTime.Value); oSimCon.setMinSpeed((int)nruMinSpeed.Value); oSimCon.setMaxSpeed((int)nruMaxSpeed.Value); oSimCon.setMaxNoFails((int)nruNoFails.Value); if (!cbInstant.Checked && !cbTaxi.Checked && !cbTime.Checked && !cbAlt.Checked && !cbSpeed.Checked) { MessageBox.Show("At least one checkbox in \"When fail can occur\" have to be checked", "Error", MessageBoxButtons.OK); } else { oSimCon.setWhenFail(cbInstant.Checked, cbTaxi.Checked, cbTime.Checked, cbAlt.Checked, cbSpeed.Checked); oSimCon.prepareFailures(); btnStop.Enabled = true; stopToolStripMenuItem.Enabled = true; btnStart.Enabled = false; StartToolStripMenuItem.Enabled = false; } } }