public void movedown(int pos) { if (pos < playlist.Count - 1) { PLItem a = playlist.ElementAt(GetIndexByPosition(pos)); PLItem b = playlist.ElementAt(GetIndexByPosition(pos + 1)); int holder = a.position; a.position = b.position; b.position = holder; playlist.Sort(comparebypos); } }
private static int comparebypos(PLItem a, PLItem b) { if (b.position > a.position) { return(-1); } else if (a.position > b.position) { return(1); } else { return(0); } }
public void addItem(PLItem item) { item.position = playlist.Count; playlist.Add(item); }
private bool matchespos(PLItem p) { return(p.position == needle); }