/// <summary> /// Method to create a new album, opens the new album window and awaits dialogue result before saving the created album to the album manager instance. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void new_btn_Click(object sender, RoutedEventArgs e) { NewEditDialogue newEditDialogue = new NewEditDialogue(); newEditDialogue.ShowDialog(); if (newEditDialogue.DialogResult == true) { Album album = new Album(newEditDialogue.Album.AlbumTitle, newEditDialogue.Album.AlbumDescription); albumManager.AddNewAlbum(album); SerializationHelper.Serialize(albumManager); } }
/// <summary> /// Method to edit the information of a single album from the "open" option in the context menu. It sends the chosen album to the edit window for editing. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnEdit_onClick(object sender, RoutedEventArgs e) { MenuItem menuItem = sender as MenuItem; int index = ListViewAlbums.Items.IndexOf(menuItem.DataContext); NewEditDialogue newEditDialogue = new NewEditDialogue(albumManager.GetAlbumAtIndex(index)); newEditDialogue.ShowDialog(); if (newEditDialogue.DialogResult == true) { albumManager.GetAlbumAtIndex(index).AlbumTitle = newEditDialogue.Album.AlbumTitle; albumManager.GetAlbumAtIndex(index).AlbumDescription = newEditDialogue.Album.AlbumDescription; ListViewAlbums.Items.Refresh(); //refresh GUI SerializationHelper.Serialize(albumManager); } }