Exemplo n.º 1
0
 private void driveB_Click(object sender, EventArgs e)
 {
     try
     {
         m_car.drive(int.Parse(minTB.Text));
     }
     catch (FormatException)
     {
         MessageBox.Show("Invalid Parameters.");
     }
     UpdateForm();
 }
Exemplo n.º 2
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            car.drive(m_minutes++);

            if (car.gasLeft() <= 0)
            {
                driveButton.Text = "Drive";

                timer2.Enabled = false;
                timer1.Enabled = false;

                MessageBox.Show("You are out of gas, get some more!");
            }
        }