private void btnTraining_Click(object sender, EventArgs e) { Image I = Image.FromFile("C:\\Users\\maxhe\\Source\\Repos\\Maatwerk\\OOP Atleten\\kaart.png"); Training H = new Hardlooptrainings(Convert.ToDateTime("28-03-2017 14:20:00"), 30, 5, "leuk", "zon", new Parcours("C:\\Users\\maxhe\\Source\\Repos\\Maatwerk\\OOP Atleten\\kaart.png", "lang", 20, 5, 50, false)); Atleet.VoegTrainingToe(H); }
public void VoegTrainingToe(Training training) { Trainingen.Add(training); if (training.GetType() == typeof(Hardlooptrainings)) { foreach (Schoen S in Schoenen) { if (S.InGebruik) { Hardlooptrainings hardloop = (Hardlooptrainings)training; S.AantalKmOptellen(hardloop.Parcour.AfstandKm); } } } }