Esempio n. 1
0
        public void LoadMusic()
        {
            TreeNode artistsNode = treeView1.Nodes[0].Nodes[0];

            try
            {
                var tracks = MusicLibrary.GetAllTracks();
                listView1.ReloadListView(tracks);
                var artists = MusicLibrary.GetAllArtists();
                foreach (Artist artist in artists)
                {
                    TreeNode tn = treeView1.Nodes[0].Nodes[0].Nodes.Add(artist.Name);
                    tn.Tag = "urn:artist:" + artist.Name + ":track";
                    var albums = MusicLibrary.GetAlbumsByArtist(artist.Name);
                    foreach (Album album in albums)
                    {
                        TreeNode trAlbum = tn.Nodes.Add(album.Name);
                        trAlbum.Tag = "urn:artist:" + artist.Name + ":album:" + album.Name + ":track";
                        tn.Nodes.Add(trAlbum);
                    }
                }

                listView1.Colorize();
            }
            catch (Exception e)
            {
            }
        }