public void SetCurrentSong(bool autoPlay) { if (CurrentSong.IsEmptyOrLoading || CurrentSong == openSong) { return; } StorageFile file; this.autoPlay = autoPlay; pauseAllowed = !autoPlay; BackgroundMediaPlayer.Current.AutoPlay = false; try { file = CurrentSong.GetStorageFile(); BackgroundMediaPlayer.Current.SetFileSource(file); FolderMusicUwpLib.SaveTextClass.SaveText("Set", CurrentSong.Title); } catch { FolderMusicUwpLib.SaveTextClass.SaveText("Catch", CurrentSong.Title); SkipSong(CurrentSong); Task.Delay(100).Wait(); BackgroundMediaPlayer.Current.SetUriSource(null); if (playNext) { Next(true); } else { Previous(); } } }