示例#1
0
        private void OnDelPlayList(ListBox listBox)
        {
            var songListItem = listBox.SelectedItem as SongListStyle;

            if (songListItem == null)
            {
                return;
            }
            var delSong  = SongListModel.GetPlayingSong(songListItem.Song.Path);
            var songList = PlayListItem.Select(i => i.Song).ToList();

            songList.Remove(delSong);
            PlayListItem = SongListModel.InitialSongList(songList);

            IsPlayListChanged = true;

            PlayingListModel.ClearPlayingList();
            PlayingListModel.SavePlayingList(songList);

            //若删除的歌曲为正在播放的歌曲
            if (delSong.Equals(PlayingSong))
            {
                OnNext();                //播放下一曲
            }
        }
示例#2
0
        /// <summary>
        /// 确认选中的标签,在歌曲列表显示包含选中标签的歌曲
        /// </summary>
        private void OnSelectTags()
        {
            //Songs.SongList.Clear();
            var songList = SongListModel.GetSelectedSongs();

            InitialSongs = new List <SongListStyle>(SongListModel.InitialSongList(songList));
        }
示例#3
0
        /// <summary> 初始化歌曲列表、播放列表和初始歌曲 </summary>
        private void InitialSongLists()
        {
            InitialSongs = SongListModel.InitialSongList(SongListModel.GetSongsDb());
            PlayListItem = SongListModel.InitialSongList(PlayingListModel.GetPlayingList());

            var firstOrDefault = PlayListItem.FirstOrDefault();

            if (firstOrDefault != null)
            {
                PlayingSong = firstOrDefault.Song;
                ControlService.PlayService.SongPath = PlayingSong.Path;
                ControlService.PlayState            = PlayState.暂停;
            }
        }
示例#4
0
        private void OnAddPlayList(ListBox listBox)
        {
            var songList     = PlayListItem.Select(i => i.Song).ToList();
            var songListItem = listBox.SelectedItem as SongListStyle;

            if (songListItem == null)
            {
                return;
            }
            songList.Add(songListItem.Song);
            PlayListItem = SongListModel.InitialSongList(songList);

            IsPlayListChanged = true;

            PlayingListModel.ClearPlayingList();
            PlayingListModel.SavePlayingList(songList);
        }
示例#5
0
        /// <summary>
        /// 从目录添加歌曲
        /// </summary>
        private void OnAddSongSet()
        {
            var songList = new List <Song>();

            using (var dirChooser = new System.Windows.Forms.FolderBrowserDialog())
            {
                if (dirChooser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    var songModel = new SongListModel();
                    songList = songModel.LoadSongList(dirChooser.SelectedPath);
                }
            }
            var initialSongs = new SongListModel();

            initialSongs.SaveSongsDb(songList);
            InitialSongs = new List <SongListStyle>(initialSongs.InitialSongList(songList));
        }
示例#6
0
        /// <summary> 播放选中标签的歌曲 </summary>
        private void PlaySongExecute()
        {
            PlayListItem.Clear();

            var songList = InitialSongs.Select(i => i.Song).ToList();

            PlayListItem = SongListModel.InitialSongList(songList);

            IsPlayListChanged = true;

            PlayingListModel.ClearPlayingList();
            PlayingListModel.SavePlayingList(songList);
            if (ControlService.PlayState != PlayState.播放)
            {
                ControlService.PlayState = PlayState.播放;
            }
        }