Ejemplo n.º 1
0
        }                                     // trường dữ liệu sử dụng trong ListMusicDialog playlist

        public SongModel Copy()
        {
            SongModel newSong = new SongModel();

            newSong.SongKey             = this.SongKey;
            newSong.SongName            = this.SongName;
            newSong.SongLocation        = this.SongLocation;
            newSong.Title               = this.Title;
            newSong.ContributingArtists = this.ContributingArtists;
            newSong.Album               = this.Album;
            newSong.Genre               = this.Genre;
            newSong.Length              = this.Length;
            newSong.LyricPath           = this.LyricPath;
            newSong.PlayingKey          = this.PlayingKey;
            return(newSong);
        }
Ejemplo n.º 2
0
 public static void GoToSongInPlayingQueue(SongModel selectedSong)
 {
     if (NowPlayingSong.SongIsPlaying != null)
     {
         if (NowPlayingSong.SongIsPlaying.PlayingKey == selectedSong.PlayingKey)
         {
             return;
         }
         else
         {
             NowPlayingSong.SongIsPlaying = selectedSong;
         }
     }
     else
     {
         NowPlayingSong.SongIsPlaying = selectedSong;
     }
 }
Ejemplo n.º 3
0
        public static void AddSongToUpNextListAndPlay(SongModel song)
        {
            if (song == null)
            {
                return;
            }
            SongModel newSong = song.Copy();
            //upNextList.Add(song);
            List <SongModel> NewPlayingQueue = new List <SongModel>(upNextList);

            newSong.PlayingKey = MyUtilites.MyFunction.GenerateCode();
            NewPlayingQueue.Add(newSong);

            upNextList = NewPlayingQueue;

            UpNextListChange();
            ChangeSongToPlayEvent(upNextList.Count - 1);
        }
Ejemplo n.º 4
0
        public static void PlayAllSongList(List <SongModel> songList)
        {
            List <SongModel> NewPlayingQueue = new List <SongModel>(upNextList);
            int indexSongToPlay = NewPlayingQueue.Count;

            foreach (SongModel song in songList)
            {
                SongModel newSong = song.Copy();
                newSong.PlayingKey = MyUtilites.MyFunction.GenerateCode();
                NewPlayingQueue.Add(newSong);
            }
            UpNextList = NewPlayingQueue;
            UpNextListChange();

            if (indexSongToPlay <= NewPlayingQueue.Count)
            {
                ChangeSongToPlayEvent(indexSongToPlay);
            }
        }
Ejemplo n.º 5
0
        public static void RemoveSongOutOfUpNextList(SongModel SongWillRemove)
        {
            List <SongModel> NewPlayingQueue = new List <SongModel>();

            //xóa bài hát trong queue

            for (int i = 0; i < upNextList.Count; i++)
            {
                if (upNextList[i].PlayingKey != SongWillRemove.PlayingKey)
                {
                    NewPlayingQueue.Add(upNextList[i]);
                }
                else
                if (NowPlayingSong.SongIsPlaying != null)
                {
                    if (SongWillRemove.PlayingKey == NowPlayingSong.SongIsPlaying.PlayingKey)
                    {
                        if (upNextList.Count >= 2)
                        {
                            LoadNextSong();
                        }
                        else
                        {
                            NowPlayingSong.StopSong();
                        }
                    }
                }
            }
            upNextList = NewPlayingQueue;
            UpNextListChange();


            //tìm index của bài hát đang chạy đẻ thông báo cho now playing view;
            for (int i = 0; i < upNextList.Count; i++)
            {
                if (NowPlayingSong.SongIsPlaying.PlayingKey == upNextList[i].PlayingKey)
                {
                    ChangeSongToPlayEvent(i);
                    return;
                }
            }
        }