public bool AdvanceNext(out string filename, out int track) { filename = string.Empty; track = 0; if (PlaylistView.RowCount == 0) { return(false); } if (PlaylistView.SelectedRows.Count == 0) { return(false); } int index = PlaylistView.SelectedRows[0].Index; PlaylistView.ClearSelection(); if (RandomMode) { Random rand = new Random(); int newRandomIndex = rand.Next(0, PlaylistView.RowCount); while (newRandomIndex == index) { newRandomIndex = rand.Next(0, PlaylistView.RowCount); } index = newRandomIndex; } else { index++; if (index == PlaylistView.RowCount) { if (LoopMode) { index = 0; } else { return(false); } } } DataGridViewRow row = PlaylistView.Rows[index]; if (row != null && row.DataBoundItem is BmpMidiEntry entry) { filename = entry.FilePath.FilePath; track = entry.Track.Track; row.Selected = true; } return(true); }
public void Deselect() { PlaylistView.ClearSelection(); }