protected void OnLast() { if (PlayListItem == null || PlayListItem.Count == 0) { return; } var songList = PlayListItem.Select(i => i.Song).ToList(); var playingIndex = songList.IndexOf(PlayingSong); if (PlayMode == PlayMode.随机播放 && IsPlayListChanged) { PlayModeService.ChangeRandomList(songList); IsPlayListChanged = false; } PlayingSong = PlayModeService.OnLastExecute(PlayMode, songList, playingIndex); if (ControlService.PlayState != PlayState.播放) { ControlService.PlayState = PlayState.播放; } else { ControlService.PlayService.MediaPlayer.Play(); } }
private void OnModeChange() { PlayMode = PlayModeService.OnModeChange(PlayMode); if (PlayMode == PlayMode.随机播放) { PlayModeService.ChangeRandomList(PlayListItem.Select(i => i.Song).ToList()); } }
private void MediaEnd(object sender, EventArgs e) { if (PlayListItem == null || PlayListItem.Count == 0) { return; } var songList = PlayListItem.Select(i => i.Song).ToList(); var playingIndex = songList.IndexOf(PlayingSong); if (PlayMode == PlayMode.随机播放 && IsPlayListChanged) { PlayModeService.ChangeRandomList(songList); IsPlayListChanged = false; } PlayingSong = PlayModeService.GetNextSong(PlayMode, songList, playingIndex); ControlService.PlayService.MediaPlayer.Play(); }
/// <summary> /// 先初始化构造函数,再初始化属性 /// </summary> public TagsSelectService() { SongListModel = new SongListModel(); PlayingListModel = new PlayingListModel(); ControlService = new ControlService(); PlayMode = PlayMode.列表循环; InitialSongs = new List <SongListStyle>(); PlayListItem = new List <SongListStyle>(); InitialSongLists(); PlayModeService = new PlayModeService(PlayMode); ControlService.PlayService.MediaPlayer.MediaEnded += MediaEnd; SelectTagsCommand = new DelegateCommand(OnSelectTags); PlaySongCommand = new DelegateCommand(PlaySongExecute); AddSongSetCommand = new DelegateCommand(OnAddSongSet); NextCommand = new DelegateCommand(OnNext); LastCommand = new DelegateCommand(OnLast); ModeChangeCommand = new DelegateCommand(OnModeChange); SelectTagCommand = new DelegateCommand <Button>(SelectTagExecute); TestCommand = new DelegateCommand(TestExecute); PlayPauseCommand = new DelegateCommand(OnPlayPause); }