示例#1
0
        private void treeMain_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            FunctionController fc         = new FunctionController();
            string             typeOfNode = getTypeOfNode(e.Node);

            setDetailEditingPanelsInvisible();
            if (typeOfNode == "interpret")
            {
                String       interpretName = e.Node.Text;
                InterpretDTO iDTO          = fc.getInterpretByName(interpretName);
                löschenToolStripMenuItem.Enabled             = true;
                alsFavoritMarkierenToolStripMenuItem.Enabled = true;

                pnDetailEditingInterpret.Visible            = true;
                edDetailEditingInterpretName.Text           = iDTO.getName();
                edDetailEditingInterpretFoundationYear.Text = iDTO.getFoundationYear();
                edDetailEditingInterpretLand.Text           = iDTO.getLand();
                edDetailEditingInterpretNoOfAlbums.Text     = fc.getAlbumsByInterpret(iDTO.getName()).Count.ToString();
            }
            else if (typeOfNode == "album")
            {
                String         albumName = e.Node.Text;
                AlbumDTO       aDTO      = fc.getAlbumByName(albumName);
                List <SongDTO> songs     = new List <SongDTO>();
                listSongs.Items.Clear();

                pnDetailEditingAlbum.Visible       = true;
                edDetailEditingAlbumName.Text      = aDTO.getName();
                edDetailEditingAlbumInterpret.Text = fc.getInterpretNameById(aDTO.getInterpret());
                edDetailEditingAlbumYear.Text      = aDTO.getReleaseYear();
                edDetailEditingAlbumGenre.Text     = fc.getGenreById(aDTO.getGenre());
                if (aDTO.getCoverpath() != null && aDTO.getCoverpath() != "")
                {
                    pictureBox1.Image    = Image.FromFile(aDTO.getCoverpath());
                    pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
                }
                else
                {
                    pictureBox1.Image = null;
                }

                songs = fc.getAllSongsByAlbum(albumName);
                foreach (SongDTO song in songs)
                {
                    listSongs.Items.Add(song.getTrackNo() + " - " + song.getName() + " | " + song.getDuration());
                }
            }
        }