public void Next(bool isShuffle, bool isRepeat) { if (isShuffle != true) { if (currentPosition + 1 < MediaList.Count()) { currentPosition++; } else if (isRepeat == true) { currentPosition = 0; } else { return; } } else { int randomNum; do { Random random = new Random(); randomNum = random.Next(0, MediaList.Count()); } while (currentPosition == randomNum && MediaList.Count != 1); currentPosition = randomNum; } SetSourceAndPlay(); }