Example #1
0
 private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem element in lstSongs.SelectedItems)
     {
         toServer.deleteSong(element.SubItems[2].Text, element.SubItems[3].Text, element.Text);
     }
     Artists = toServer.getArtistList();
     Albums  = toServer.getAlbumList();
     Songs   = toServer.getSongList();
 }
Example #2
0
        //Search
        private void toolStripButton6_Click(object sender, EventArgs e)
        {
            AlbumForArtist.Images.Clear();
            Searches.Visible = true;
            String     search   = toolStripTextBox2.Text;
            ArtistList artList  = toServer.getSearchedArtist(search);
            AlbumList  albList  = toServer.getSearchedAlbum(search);
            List       songList = toServer.getSearchedSong(search);

            //Artists
            for (int i = 0; i < artList.getLength(); i++)
            {
                Artist       artist = artList.getValue(i);
                ListViewItem art    = new ListViewItem(artist.getName(), i, listView3.Groups[0]);
                AlbumForArtist.Images.Add(artist.GetImage());

                art.Text = artist.getName();
                listView3.Items.Add(art);
            }
            //Albums
            for (int i = 0; i < albList.getLength(); i++)
            {
                Album        album = albList.getValue(i);
                ListViewItem art   = new ListViewItem(album.getName(), (artList.getLength() - 1 + i), listView3.Groups[1]);
                AlbumForArtist.Images.Add(album.GetBitImage());
                art.SubItems.Add(album.getArtist().getName());
                art.Text = album.getName();
                listView3.Items.Add(art);
            }
            //Songs
            for (int i = 0; i < songList.getLength(); i++)
            {
                Song         song = songList.getValue(i);
                ListViewItem art  = new ListViewItem(song.getName(), (artList.getLength() - 1 + albList.getLength() - 1 + i), listView3.Groups[2]);
                AlbumForArtist.Images.Add(song.getAlbum().GetBitImage());
                art.SubItems.Add(song.getArtist().getName());
                art.SubItems.Add(song.getAlbum().getName());
                art.Text = song.getName();
                listView3.Items.Add(art);
            }
        }
Example #3
0
 //Searches Click
 private void listView3_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem element in listView3.SelectedItems)
     {
         if (element.Group == listView3.Groups[0])//Artist
         {
             toServer.addArtist(element.Text);
         }
         else if (element.Group == listView3.Groups[1]) //Album
         {
             toServer.addAlbum(element.Text, element.SubItems[1].Text);
         }
         else if (element.Group == listView3.Groups[2])//Song
         {
             toServer.addSong(element.Text, element.SubItems[2].Text, element.SubItems[1].Text);
         }
     }
     Artists = toServer.getArtistList();
     Albums  = toServer.getAlbumList();
     Songs   = toServer.getSongList();
 }
Example #4
0
        private void addFileToToolStripMenuItem_Click(object sender, EventArgs e)//Revisar
        {
            OpenFileDialog SearchBox = new OpenFileDialog();

            SearchBox.Multiselect = true;
            if (SearchBox.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                foreach (var dic in SearchBox.FileNames)
                {
                    bool addArt = false;
                    bool addAlb = false;

                    TagLib.File data = TagLib.File.Create(dic);
                    //Instance info on lists
                    Artist art;
                    Album  alb;
                    Song   newSong;
                    //Get SongInfo
                    String artist;
                    String name;
                    String album;
                    uint   year;
                    uint   index = data.Tag.Track;
                    uint   Disc;
                    String URL = dic;
                    //Artist
#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
                    try
                    {
                        artist = data.Tag.Artists[0];
                    }
                    catch
                    {
                        artist = "Uknown Artist";
                    }
                    //Title
                    try
                    {
                        name = data.Tag.Title;
                    }
                    catch
                    {
                        name = "Uknown Song";
                    }
                    //Album
                    try
                    {
                        album = data.Tag.Album;
                    }
                    catch
                    {
                        album = "Uknown album";
                    }
                    //Year
                    try
                    {
                        year = data.Tag.Year;
                    }
                    catch
                    {
                        year = 0;
                    }
                    //Disc
                    try
                    {
                        Disc = data.Tag.Disc;
                    }
                    catch
                    {
                        Disc = 1;
                    }
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos

                    //Add to Artist
                    if (Artists.searchName(artist))
                    {
                        art = Artists.searchArtist(artist);
                    }
                    else
                    {
                        addArt = true;
                        art    = new Artist(artist, Properties.Resources.descarga__2_);//Change Image
                    }
                    //Add to Album
                    if (art.getAlbums().searchName(album))
                    {
                        alb = art.getAlbums().searchAlbum(album);
                    }
                    else
                    {
                        addAlb = true;
                        alb    = new Album(album, art, Properties.Resources.album);
                        art.getAlbums().add(alb);
                        art.getAlbums().sort("year");
                    }
                    //Add to Songs
                    if (!alb.getSongs().searchName(name))
                    {
                        newSong = new Song(name, art, alb, year, Disc, index, URL);
                        toServer.sendMP3File(newSong);
                        alb.getSongs().add(newSong);
                        alb.setYear(year);
                        Songs.add(newSong);
                    }

                    if (addArt)
                    {
                        Artists.add(art);
                    }
                    if (addAlb)
                    {
                        Albums.add(alb);
                    }
                }
            }
            toServer.sendArtistList(Artists);
            toServer.sendAlbumList(Albums);
            toServer.sendSongList(Songs);
            Artists = toServer.getArtistList();
            Albums  = toServer.getAlbumList();
            Songs   = toServer.getSongList();
            drawOnSongList();
            drawOnArtistList();
            drawOnAlbumList();
            Console.WriteLine("Items agregados");
        }
Example #5
0
 public void setAlbums(AlbumList albums)
 {
     Albums = albums;
 }
Example #6
0
 public void sendAlbumList(AlbumList list)
 {
     throw new NotImplementedException();
 }