Esempio n. 1
0
        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;
                }
            }
        }
Esempio n. 2
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            if (btnConnect.Text == "Connect")
            {
                if (checkMinMax())
                {
                    statusLabel.Text = oSimCon.Connect();

                    if (statusLabel.Text == "SimConnect connected")
                    {
                        btnConnect.Text = "Disconnect";
                        connectToolStripMenuItem.Text = "Disconnect";
                        btnStart.Enabled = true;
                        StartToolStripMenuItem.Enabled = false;
                    }
                }
            }
            else
            {
                statusLabel.Text = oSimCon.Disconnect();
                btnConnect.Text  = "Connect";
                connectToolStripMenuItem.Text = "Connect";
                btnStart.Enabled = false;
                StartToolStripMenuItem.Enabled = false;
                btnStop.Enabled = false;
                stopToolStripMenuItem.Enabled = false;
            }
        }