Ejemplo n.º 1
0
        private void SortByArtistToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var SortedList = Music.OrderBy(x => TagFile.GetArtists(x)).ThenBy(x => TagFile.GetAlbum(x)).ThenBy(x => TagFile.GetTrack(x)).ToList();

            // The only reason make me keep All this Code bellow on comment, is that i found a better and small way to do it (The Line upove)
            #region The Comment Code

            /*  //  I use the OrderBy function and the Linq, to sort the list on the Album
             * List<string> MusicListCopy = Music.OrderBy(o => TagFile.Album(o)).ToList();
             * List<string> AllAlbumsName = new List<string>();
             *
             * foreach (var item in MusicListCopy)
             *  AllAlbumsName.Add(TagFile.Album(item));
             * //  Reamove all the rapeated AlbumName on the list
             * AllAlbumsName = AllAlbumsName.Distinct().ToList();
             *
             * List<string> SortedList = new List<string>();
             * List<string> OnlyOneAlbumMusic = new List<string>();
             *
             * foreach (var ItemInAllAlbumsName in AllAlbumsName)
             * {
             *  foreach (var ItemInMusic in Music)
             *  {
             *      if (TagFile.Album(ItemInMusic) == ItemInAllAlbumsName)
             *      {
             *          OnlyOneAlbumMusic.Add(ItemInMusic);
             *          MusicListCopy.Remove(ItemInMusic);
             *      }
             *  }
             *
             *  OnlyOneAlbumMusic = OnlyOneAlbumMusic.OrderBy(o => TagFile.Track(o)).ToList();
             *
             *  foreach (var item in OnlyOneAlbumMusic)
             *      SortedList.Add(item);
             *  OnlyOneAlbumMusic.Clear();
             * }
             *
             * SortedList = SortedList.OrderBy(o => TagFile.Artist(o)).ToList();   */
            #endregion

            // Clear the Lists and initialize the index and waveoutevent to null
            ClearListToolStripMenuItem.PerformClick();

            //  Initialize the list and Play the first music
            AddItemsInListToTheMainList(SortedList);

            LastSortedMethode = SortedMethode.Artist;

            SortByArtistToolContextMenuStriItem.Checked = true;
            SortByTitleToolContextMenuStriItem.Checked  = false;
            SortByAlbumToolContextMenuStriItem.Checked  = false;

            ArtistToolStripMenuItem.Checked = true;
            TitleToolStripMenuItem.Checked  = false;
            AlbumToolStripMenuItem.Checked  = false;
        }
Ejemplo n.º 2
0
        private void MusicPlayer_Load(object sender, EventArgs e)
        {
            Music                    = new List <string>();
            RandomValue              = new Random();
            MusicState               = MusicState.Pause;
            ShuffleState             = ShuffleState.Off;
            LoopState                = LoopState.Off;
            CurrentPlayingMusicIndex = 0;
            IsFileGenerateException  = false;
            LastSortedMethode        = SortedMethode.Title;

            AudioExtensions = new List <string>()
            {
                ".mp3", ".m4a", ".ogg", ".wav", ".3gp", ".flac", ".m4b", ".m4p", ".mpeg", ".mp4"
            };

            PlaybackBarControl.ChangedProgressPanel.MouseMove += ChangedProgressPanel_MouseMove;
        }
Ejemplo n.º 3
0
        private void SortByAlbumToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //  Sort thelist by the Album then the Track Number
            var SortedList = Music.OrderBy(x => TagFile.GetAlbum(x)).ThenBy(x => TagFile.GetTrack(x)).ToList();

            // Clear the Lists and initialize the index and waveoutevent to null
            ClearListToolStripMenuItem.PerformClick();

            //  Initialize the list and Play the first music
            AddItemsInListToTheMainList(SortedList);

            LastSortedMethode = SortedMethode.Album;

            SortByAlbumToolContextMenuStriItem.Checked  = true;
            SortByTitleToolContextMenuStriItem.Checked  = false;
            SortByArtistToolContextMenuStriItem.Checked = false;

            AlbumToolStripMenuItem.Checked  = true;
            TitleToolStripMenuItem.Checked  = false;
            ArtistToolStripMenuItem.Checked = false;
        }
Ejemplo n.º 4
0
        private void SortByTitleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //  I use the OrderBy function and the Linq, to sort the list on the title
            List <string> SortedList = Music.OrderBy(o => TagFile.GetTitle(o)).ToList();

            // Clear the Lists and initialize the index and waveoutevent to null
            ClearListToolStripMenuItem.PerformClick();

            //  Initialize the list and Play the first music
            AddItemsInListToTheMainList(SortedList);

            LastSortedMethode = SortedMethode.Title;

            SortByTitleToolContextMenuStriItem.Checked  = true;
            SortByArtistToolContextMenuStriItem.Checked = false;
            SortByAlbumToolContextMenuStriItem.Checked  = false;

            TitleToolStripMenuItem.Checked  = true;
            ArtistToolStripMenuItem.Checked = false;
            AlbumToolStripMenuItem.Checked  = false;
        }