Exemple #1
0
        private void AddContextMenuItem_Click(object sender, EventArgs e)
        {
            AddModifyForm addModifyForm = new AddModifyForm(null);

            if (addModifyForm.ShowDialog() == DialogResult.OK)
            {
                Song newSong = new Song(addModifyForm.SongTitle, addModifyForm.SongAuthor, addModifyForm.SongDate, addModifyForm.SongCategory);

                Data.AddSong(newSong);
            }
        }
Exemple #2
0
        private void ModifyContextMenuItem_Click(object sender, EventArgs e)
        {
            if (SongsList.SelectedItems.Count == 1)
            {
                Song          song          = (Song)SongsList.SelectedItems[0].Tag;
                AddModifyForm addModifyForm = new AddModifyForm(song);
                if (addModifyForm.ShowDialog() == DialogResult.OK)
                {
                    song.Title       = addModifyForm.SongTitle;
                    song.Author      = addModifyForm.SongAuthor;
                    song.ReleaseDate = addModifyForm.SongDate;
                    song.Category    = addModifyForm.SongCategory;

                    Data.UpdateSong(song);
                }
            }
        }