internal Playlist.Playlist getDefaultPlaylist()
        {
            //p_get_playlist_default
            Playlist.Playlist data = null;
            try
            {
                using (MySqlConnection conn = new MySqlConnection(App.setting.connectString))
                {
                    conn.Open();
                    string query = "`p_get_playlist_default`";
                    using (MySqlCommand cmd = new MySqlCommand(query, conn))
                    {
                        cmd.Parameters.Add(new MySqlParameter("@_user_id", MySqlDbType.Int32)
                        {
                            Direction = System.Data.ParameterDirection.Input, Value = this.ID
                        });

                        cmd.CommandType = System.Data.CommandType.StoredProcedure;
                        cmd.ExecuteScalar();
                        using (MySqlDataReader reader = cmd.ExecuteReader())
                        {
                            data = reader.toPlaylist();
                        }
                    };
                    conn.Close();
                };
            }
            catch (Exception ex)
            {
                Console.Write(ex.GetBaseException().ToString());
            }
            return(data);
        }
        private void PlayPreviousMedia_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Playlist.Playlist playlist = new Playlist.Playlist();
            playlist.previousSong();

            Global_Log.allSongTrack = true;
        }
        //public event OnNext (object sender);
        private void PlayNextMedia_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Playlist.Playlist playlist = new Playlist.Playlist();
            playlist.nextSong();

            //Global_Log.allSongTrack      = true;
            //Global_Log.playlistSongTrack = true;
        }
예제 #4
0
 public void MoveSong_IDOfThirdSongShouldBe1()
 {
     Playlist.Playlist playlist = new Playlist.Playlist();
     List<Song> songList = new List<Song>();
     songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
     playlist.UpdateList(new ObservableCollection<Song>(songList));
     playlist.MoveSong(0, 2);
     Assert.AreEqual(1, playlist.GetList()[2].ID);
 }
예제 #5
0
 public void GetAndUpdateList_IDOfFirstAndFourthSongsShouldBeTheSameInBothListAndInsertedArray()
 {
     Playlist.Playlist playlist = new Playlist.Playlist();
     List<Song> songList = new List<Song>();
     songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
     playlist.UpdateList(new ObservableCollection<Song>(songList));
     Assert.AreEqual(1, playlist.GetList()[0].ID);
     Assert.AreEqual(4, playlist.GetList()[3].ID);
 }
예제 #6
0
        public void GetAndUpdateList_IDOfFirstAndFourthSongsShouldBeTheSameInBothListAndInsertedArray()
        {
            Playlist.Playlist playlist = new Playlist.Playlist();
            List <Song>       songList = new List <Song>();

            songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
            playlist.UpdateList(songList);
            Assert.AreEqual(1, playlist.GetList()[0].ID);
            Assert.AreEqual(4, playlist.GetList()[3].ID);
        }
예제 #7
0
 private PlaybackManager()
 {
     Playlist = new Playlist.Playlist();
     _states  = new IState[] { new Stopped(), new Paused(), new Playing() };
     SetState(PlaybackState.Stopped);
     _playbackTimer.Tick        += PlaybackTimerOnTick;
     Playlist.CollectionChanged += Playlist_CollectionChanged;
     Balance = (decimal)SettingsManager.Instance["Balance"].Value;
     Volume  = (decimal)SettingsManager.Instance["Volume"].Value;
 }
예제 #8
0
 public void AddToList_IDOfFirstSongInArrayAndFifthSongInListShouldBeTheSame()
 {
     Playlist.Playlist playlist = new Playlist.Playlist();
     List<Song> songList = new List<Song>();
     songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
     playlist.UpdateList(new ObservableCollection<Song>(songList));
     Song[] insertedArrayOfSongs = new Song[] { new Song(9), new Song(8), new Song(7) };
     playlist.AddToList(insertedArrayOfSongs, 4);
     Assert.AreEqual(insertedArrayOfSongs[0].ID, playlist.GetList()[4].ID);
 }
예제 #9
0
        public void MoveSong_IDOfThirdSongShouldBe1()
        {
            Playlist.Playlist playlist = new Playlist.Playlist();
            List <Song>       songList = new List <Song>();

            songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
            playlist.UpdateList(songList);
            playlist.MoveSong(0, 2);
            Assert.AreEqual(1, playlist.GetList()[2].ID);
        }
예제 #10
0
        public void AddToList_IDOfFirstSongInArrayAndFifthSongInListShouldBeTheSame()
        {
            Playlist.Playlist playlist = new Playlist.Playlist();
            List <Song>       songList = new List <Song>();

            songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
            playlist.UpdateList(songList);
            Song[] insertedArrayOfSongs = new Song[] { new Song(9), new Song(8), new Song(7) };
            playlist.AddToList(insertedArrayOfSongs, 4);
            Assert.AreEqual(insertedArrayOfSongs[0].ID, playlist.GetList()[4].ID);
        }
예제 #11
0
        public PlaylistModule(Playlist.Playlist Playlist)
        {
            #region Error checking
            if (Playlist == null)
            {
                throw new ArgumentNullException(nameof(Playlist));
            }
            #endregion

            this.playlist = Playlist;
        }
예제 #12
0
 public void RemoveSong_IDsOfThirdSongShouldBe4AndFirstSongShouldBe2()
 {
     Playlist.Playlist playlist = new Playlist.Playlist();
     List<Song> songList = new List<Song>();
     songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
     playlist.UpdateList(new ObservableCollection<Song>(songList));
     playlist.RemoveFromList(2);
     Assert.AreEqual(4, playlist.GetList()[2].ID);
     playlist.RemoveFromList(0);
     Assert.AreEqual(2, playlist.GetList()[0].ID);
 }
예제 #13
0
 public void SearchSong_IDOfFirstSongShouldBe2()
 {
     Playlist.Playlist playlist = new Playlist.Playlist();
     List<Song> songList = new List<Song>();
     songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
     songList[0].Title = "bar";
     songList[1].Title = "foo";
     songList[2].Title = "foobar";
     songList[3].Title = "baz";
     playlist.UpdateList(songList);
     Assert.AreEqual(playlist.SearchSong("foo")[0].ID, 2);
 }
예제 #14
0
 public void SortByDownloaded_PropertyDownloadedOfFirstAndSecondSongsShouldBeTrue()
 {
     Playlist.Playlist playlist = new Playlist.Playlist();
     List<Song> songList = new List<Song>();
     songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
     songList[1].Downloaded = true;
     songList[3].Downloaded = true;
     playlist.UpdateList(songList);
     playlist.SortByDownloaded();
     Assert.AreEqual(true, playlist.GetList()[0].Downloaded);
     Assert.AreEqual(true, playlist.GetList()[1].Downloaded);
 }
예제 #15
0
        public void RemoveSong_IDsOfThirdSongShouldBe4AndFirstSongShouldBe2()
        {
            Playlist.Playlist playlist = new Playlist.Playlist();
            List <Song>       songList = new List <Song>();

            songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
            playlist.UpdateList(songList);
            playlist.RemoveFromList(2);
            Assert.AreEqual(4, playlist.GetList()[2].ID);
            playlist.RemoveFromList(0);
            Assert.AreEqual(2, playlist.GetList()[0].ID);
        }
예제 #16
0
 public void SearchSong_IDOfFirstSongShouldBe2()
 {
     Playlist.Playlist playlist = new Playlist.Playlist();
     List<Song> songList = new List<Song>();
     songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
     songList[0].Title = "bar";
     songList[1].Title = "foo";
     songList[2].Title = "foobar";
     songList[3].Title = "baz";
     playlist.UpdateList(new ObservableCollection<Song>(songList));
     //TODO: rewrite tests
     //Assert.AreEqual(playlist.SearchSong("foo")[0].ID, 2);
 }
예제 #17
0
        public void SearchSong_IDOfFirstSongShouldBe2()
        {
            Playlist.Playlist playlist = new Playlist.Playlist();
            List <Song>       songList = new List <Song>();

            songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
            songList[0].Title = "bar";
            songList[1].Title = "foo";
            songList[2].Title = "foobar";
            songList[3].Title = "baz";
            playlist.UpdateList(songList);
            Assert.AreEqual(playlist.SearchSong("foo")[0].ID, 2);
        }
예제 #18
0
        public void SortByDownloaded_PropertyDownloadedOfFirstAndSecondSongsShouldBeTrue()
        {
            Playlist.Playlist playlist = new Playlist.Playlist();
            List <Song>       songList = new List <Song>();

            songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
            songList[1].Downloaded = true;
            songList[3].Downloaded = true;
            playlist.UpdateList(songList);
            playlist.SortByDownloaded();
            Assert.AreEqual(true, playlist.GetList()[0].Downloaded);
            Assert.AreEqual(true, playlist.GetList()[1].Downloaded);
        }
예제 #19
0
 public void AddToList_IDOfFirstThirdAndFiftsSongsShouldBe8()
 {
     Playlist.Playlist playlist = new Playlist.Playlist();
     List<Song> songList = new List<Song>();
     songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
     playlist.UpdateList(new ObservableCollection<Song>(songList));
     Song insertedSong = new Song(8);
     playlist.AddToList(insertedSong, 0);
     Assert.AreEqual(insertedSong.ID, playlist.GetList()[0].ID);
     playlist.AddToList(insertedSong, 5);
     Assert.AreEqual(insertedSong.ID, playlist.GetList()[5].ID);
     playlist.AddToList(insertedSong, 3);
     Assert.AreEqual(insertedSong.ID, playlist.GetList()[3].ID);
 }
예제 #20
0
        public void AddToList_IDOfFirstThirdAndFiftsSongsShouldBe8()
        {
            Playlist.Playlist playlist = new Playlist.Playlist();
            List <Song>       songList = new List <Song>();

            songList.AddRange(new Song[] { new Song(1), new Song(2), new Song(3), new Song(4) });
            playlist.UpdateList(songList);
            Song insertedSong = new Song(8);

            playlist.AddToList(insertedSong, 0);
            Assert.AreEqual(insertedSong.ID, playlist.GetList()[0].ID);
            playlist.AddToList(insertedSong, 5);
            Assert.AreEqual(insertedSong.ID, playlist.GetList()[5].ID);
            playlist.AddToList(insertedSong, 3);
            Assert.AreEqual(insertedSong.ID, playlist.GetList()[3].ID);
        }
예제 #21
0
        public override void Initialize()
        {
            base.Initialize();

            m_MpdnFormHandle = Player.ActiveForm.Handle;

            m_UpdateTimer = new Timer();
            m_UpdateTimer.Tick += UpdateTimerTick;
            m_Playlist = GetPlaylistInstance();

            Player.StateChanged += PlayerStateChanged;
            Media.Loaded += MediaLoaded;

            CreateToolBarButtons();
        }
예제 #22
0
 private PlaybackManager()
 {
     Playlist = new Playlist.Playlist();
     _states = new IState[] { new Stopped(), new Paused(), new Playing() };
     SetState(PlaybackState.Stopped);
     _playbackTimer.Tick += PlaybackTimerOnTick;
     Playlist.CollectionChanged += Playlist_CollectionChanged;
     Balance = (decimal)SettingsManager.Instance["Balance"].Value;
     Volume = (decimal)SettingsManager.Instance["Volume"].Value;
 }