diff --git a/MusicPlayer/MusicPlayer/PlaylistMaker.cs b/MusicPlayer/MusicPlayer/PlaylistMaker.cs index 9500123..58fb8d3 100644 --- a/MusicPlayer/MusicPlayer/PlaylistMaker.cs +++ b/MusicPlayer/MusicPlayer/PlaylistMaker.cs @@ -38,12 +38,15 @@ namespace MusicPlayer } } - public void Repopulate() + public void Repopulate(bool lastIndex) { int selection = PlaylistSelectBox.SelectedIndex; PlaylistSelectBox.Items.Clear(); pl.GetPlaylists().ForEach(p => PlaylistSelectBox.Items.Add(p.name)); - PlaylistSelectBox.SelectedIndex = selection; + if (lastIndex) + PlaylistSelectBox.SelectedIndex = PlaylistSelectBox.Items.Count - 1; + else + PlaylistSelectBox.SelectedIndex = selection; if (PlaylistSelectBox.SelectedItem != null) { PlaylistSongContainer.Items.Clear(); @@ -52,6 +55,11 @@ namespace MusicPlayer } } + public void Repopulate() + { + Repopulate(false); + } + public void Populate() { pl.GetPlaylists().ForEach(p => PlaylistSelectBox.Items.Add(p.name)); @@ -91,7 +99,7 @@ namespace MusicPlayer private void PlaylistNewButton_Click(object sender, EventArgs e) { pl.MakeNewPlaylistByName(PlaylistNewInputfield.Text); - Repopulate(); + Repopulate(true); } private void PlaylistMaker_Load(object sender, EventArgs e)