Example #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;
                }
            }
        }
Example #2
0
        public Form1()
        {
            InitializeComponent();
            tcFailures.TabPages.Remove(tpEvents);

            foreach (Control c in GetAll(this, typeof(NumericUpDown)))
            {
                if (c is NumericUpDown)
                {
                    if (c.Name.Contains("All"))
                    {
                        ((NumericUpDown)c).Value = nruAll.Value;
                    }
                }
            }

            oSimCon = new Simcon(this);
        }