private void TimerSimulation_Tick(object sender, EventArgs e) { if (count > 0) { if (play) { this.labelTime.Text = Simulation.Watch.Elapsed.Minutes + " Minutes " + Simulation.Watch.Elapsed.Seconds + " Seconds"; this.labelCarsAdded.Text = Simulation.TotalNumberCars.ToString(); this.labelCarsRemaining.Text = count.ToString(); this.labelLightSwitches.Text = Simulation.TotalNumberofSwitches.ToString(); this.labelCrossingNumbers.Text = Simulation.Crossings.Count.ToString(); foreach (Crossing c in Simulation.Crossings) { foreach (TrafficLane l in c.Lanes) { for (int i = 0; i < l.Cars.Count; i++) { GetAllPictureboxes(panel1); Car car = l.Cars.ElementAt(i); foreach (PictureBox p in ControlList) { p.Invalidate(); } car.DriveLane(); foreach (PictureBox p in ControlList) { p.Invalidate(); } } } //will need to be changed if (c.GetType() == typeof(Crossing_B)) { Crossing_B b = (Crossing_B)c; for (int p = 0; p < b.GetNumberOfPedesToMove(); p++) { b.pedestrians[p].Walk(); } } //ped walk stuff } } } else { this.labelCarsRemaining.Text = "0"; this.Stop(); } }