private void BtnRegisterBook_Click(object sender, EventArgs e) { try { if (!String.IsNullOrWhiteSpace(tbxTitleBook.Text)) { Bok tempBok = new Bok(tbxTitleBook.Text, int.Parse(tbxPagesBook.Text)); Media.AllMedia.Add(tempBok); UpdateTable(); ClearBook(); } else { MessageBox.Show("Du måste ge boken en titel"); } } catch { MessageBox.Show("Det går inte lägga till boken"); } }
private void BtnEdit_Click(object sender, EventArgs e) { Media m = lbxOut.SelectedItem as Media; if (m is Bok) { Bok b = m as Bok; tbxTitleBook.Text = b.Title; tbxPagesBook.Text = b.Pages.ToString(); } else if (m is AudioClip) { AudioClip b = m as AudioClip; tbxTitleAudio.Text = b.Title; tbxPlaytimeAudio.Text = b.Playtime.ToString(); } else if (m is Movie) { Movie b = m as Movie; tbxTitleBook.Text = b.Title; tbxPlaytimeMovie.Text = b.Playtime.ToString(); tbxResolutionMovie.Text = b.Resolution.ToString(); } }