Пример #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;
        }
Пример #2
0
        private void EditFormInitialise(int Index)
        {
            TextBoxGenre.AutoCompleteCustomSource.AddRange(TagLib.Genres.Audio);

            string TrackPath = MainForm.Music[Index];

            TextBoxTitle.Text      = TagFile.GetTitle(TrackPath);
            TextBoxArtists.Text    = TagFile.GetArtists(TrackPath);
            TextBoxAlbum.Text      = TagFile.GetAlbum(TrackPath);
            TextBoxTrack.Text      = TagFile.GetTrack(TrackPath);
            TextBoxTrackCount.Text = TagFile.GetTrackCount(TrackPath);
            TextBoxGenre.Text      = TagFile.GetGenre(TrackPath);
            RichTextBoxLyrics.Text = TagFile.GetLyrics(TrackPath);
            PictureBoxCover.Image  = TagFile.GetCover(TrackPath);
            TextBoxYear.Text       = TagFile.GetYear(TrackPath);

            this.Text = TextBoxTitle.Text;
        }
Пример #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;
        }