private void AddFootballer() { var footballer = new FootballerModel(TextBoxFirstName, TextBoxLastName, SliderWeight, SliderAge); _footballerList.Add(footballer); FootballerSerialization.SaveTo(serializationPath, FootballerList.ToList()); }
private void RemoveFootballer() { var atIndex = SelectedFootIndex; var dialogResult = MessageBox.Show($"Czy na pewno usunąć{Environment.NewLine}obiekt \"{FootballerList[atIndex]}\"?", "Usuń", MessageBoxButton.YesNo); if (dialogResult == MessageBoxResult.Yes) { SelectedFootIndex = -1; FootballerList.RemoveAt(atIndex); FootballerSerialization.SaveTo(serializationPath, FootballerList.ToList()); } }
private void EditFootballer() { var footballer = new FootballerModel(TextBoxFirstName, TextBoxLastName, SliderWeight, SliderAge); var dialogResult = MessageBox.Show($"Czy na pewno chcesz zmienić dane{Environment.NewLine}obiektu \"{FootballerList[SelectedFootIndex]}\"?", "Edytuj", MessageBoxButton.YesNo); if (dialogResult == MessageBoxResult.Yes) { FootballerList.Insert(SelectedFootIndex, footballer); SelectedFootIndex -= 1; FootballerList.RemoveAt(SelectedFootIndex + 1); FootballerSerialization.SaveTo(serializationPath, FootballerList.ToList()); } }