private void SaveMusicButton_Click(object sender, RoutedEventArgs e) // wegschrijven { if (SingerTextBox.Text != "" && MusicTitleTextBox.Text != "") { if (_musicController.Selected == null) // Create { Song newSong = new Song() { Singer = SingerTextBox.Text, Title = MusicTitleTextBox.Text, File = _newFile }; _musicController.AddMedia(newSong); } else // Update { Song oldSong = (Song)_musicController.Selected; oldSong.Singer = SingerTextBox.Text; oldSong.Title = MusicTitleTextBox.Text; if (oldSong.File == null) { oldSong.File = _newFile; } else if (oldSong.File != _newFile && _newFile != null) { oldSong.File = _newFile; } _musicController.ChangeSelected(oldSong); musicListBox.Items.Refresh(); playlistListBox.Items.Refresh(); } ClearSelection(); //SetMusicPlay(); } else { MessageBox.Show("Please fill in all the fields!"); } }