private void Otwarcie(object sender, RoutedEventArgs e) { var fb = Zapis.ZPliku(plik); if (fb != null) { foreach (var i in fb) { listBox1.Items.Add(i); } } }
private void Zamkniecie(object sender, System.ComponentModel.CancelEventArgs e) { int n = listBox1.Items.Count; Footballer[] fb = null; if (n > 0) { fb = new Footballer[n]; int i = 0; foreach (var p in listBox1.Items) { fb[i++] = p as Footballer; } Zapis.DoPliku(plik, fb); } }