private void btnEditMovie_Click(object sender, RoutedEventArgs e) { Movie edit = lvwMovies.SelectedItem as Movie; if (edit != null) { EditMovieWindow window = new EditMovieWindow(Database, lvwMovies.SelectedItem as Movie); window.ShowDialog(); } }
private void btnCreateMovie_Click(object sender, RoutedEventArgs e) { Movie newOne = new Movie(); EditMovieWindow window = new EditMovieWindow(Database, newOne); window.Closing += new System.ComponentModel.CancelEventHandler(delegate { if (!String.IsNullOrEmpty(newOne.Name)) { Database.Movies.Add(newOne); } }); window.ShowDialog(); }