Switch to new playlist automatically
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user