private void LetterScroll() { if (inputText == "") { return; } Song song = null; Parallel.ForEach(songList, (s, p) => { //Pretty intensive, this makes it a bit faster although not as accurate. var n = s.Name.ToLower(); if (n[0] != inputText[0]) { return; } if (!n.StartsWith(inputText)) { return; } song = s; p.Break(); }); if (song == null) { text.Color = new Color(255, 100, 100); return; } text.Color = Color.White; song.Play(); songList.ScrollToCurrentSong(); }
private void ArrowKeys(KeyEventArgs e) { if (Audio.CurrentSong == null) { return; } var pos = Audio.Current.PlayLength / 100; switch (e.Code) { case Keyboard.Key.Left: if (Audio.Current.PlayPosition > 0) { Audio.Current.PlayPosition -= pos; } break; case Keyboard.Key.Right: if (Audio.Current.PlayPosition < Audio.Current.PlayLength) { Audio.Current.PlayPosition += pos; } break; case Keyboard.Key.Up: Audio.PlayPrev(Audio.CurrentSong); songList.ScrollToCurrentSong(); break; case Keyboard.Key.Down: Audio.PlayNext(Audio.CurrentSong); songList.ScrollToCurrentSong(); break; } }