Switch to new playlist automatically

This commit is contained in:
2015-10-31 00:05:30 +01:00
parent d5bc7df7e1
commit 9d56e2e3b4
+11 -3
View File
@@ -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)