示例#1
0
        private void contextEditSelectedAlbum_Click(object sender, EventArgs e)
        {
            var selectedAlbum = trvOutput.SelectedNode;
            List <SmallClasses.MP3> tracksOnAlbum = new List <SmallClasses.MP3>();
            string checkTrack     = "";
            string artistSelected = "";
            bool   albumSelected  = false;

            //Track #:
            if (selectedAlbum.Text.Length >= 8)
            {
                checkTrack = selectedAlbum.Text.Substring(0, 8);
                if (checkTrack == "Track #:")
                {
                    MessageBox.Show("Please select an album");
                    albumSelected = false;
                }
                else
                {
                    albumSelected  = true;
                    artistSelected = Text;
                }
            }
            else
            {
                albumSelected  = true;
                artistSelected = Text;
            }
            if (albumSelected)
            {
                frmEditAlbum editThisAlbum = new frmEditAlbum
                {
                    Text      = artistSelected + " - " + selectedAlbum.Text,
                    MdiParent = _frmMain
                };
                foreach (SmallClasses.MP3 tempTrack in Program.openTracks)
                {
                    if (tempTrack.Artists == artistSelected && tempTrack.Album == selectedAlbum.Text)
                    {
                        tracksOnAlbum.Add(tempTrack);
                        //editThisAlbum.tracksOnAlbum.Add(tempTrack);
                    }
                }
                editThisAlbum.tracksOnAlbum = new SmallClasses.MP3[tracksOnAlbum.Count];
                editThisAlbum.tracksOnAlbum = tracksOnAlbum.ToArray();
                Program.refreshDGVOnChild(tracksOnAlbum, editThisAlbum);
                editThisAlbum.Show();
            }
        }
示例#2
0
 public static void refreshDGVOnChild(List <SmallClasses.MP3> tracksIn, frmEditAlbum currentChild)
 {
     currentChild.dgvOutput.DataSource            = null;
     currentChild.dgvOutput.DataSource            = tracksIn;
     currentChild.dgvOutput.RowHeadersVisible     = false;
     currentChild.dgvOutput.Columns[0].Visible    = false;
     currentChild.dgvOutput.Columns[0].HeaderText = "Original Row";
     currentChild.dgvOutput.Columns[1].Visible    = false;
     currentChild.dgvOutput.Columns[1].HeaderText = "File Path";
     currentChild.dgvOutput.Columns[2].HeaderText = "File Name";
     currentChild.dgvOutput.Columns[3].HeaderText = "Track Number";
     currentChild.dgvOutput.Columns[4].HeaderText = "Song Title";
     currentChild.dgvOutput.Columns[5].HeaderText = "Album";
     currentChild.dgvOutput.Columns[6].HeaderText = "Artists";
     currentChild.dgvOutput.AutoResizeColumns();
     currentChild.dgvOutput.Refresh();
 }