Exemple #1
0
        // Add Movie to Movie List, calling class - Need all code, checked over
        private void btnAddWatch_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string movieName        = tbxMovieName.Text;
                string movieGenre       = cbxGenre.SelectedItem.ToString();
                string movieDescription = tbxDescription.Text;

                WatchedMovies movie1 = new WatchedMovies(movieName, movieGenre, movieDescription, "", DateTime.MinValue);

                AllMovies.Add(movie1);

                lbxWatchlist.ItemsSource = null;
                lbxWatchlist.ItemsSource = AllMovies;

                tbxMovieName.Clear();
                tbxDescription.Clear();
                cbxGenre.SelectedIndex = 0;

                imgGenre.Source       = null;
                tblkGenreHeading.Text = "";
            }

            catch (Exception ex)
            {
                MessageBox.Show("A handled exception just occured" + ex.Message);
            }
        }
Exemple #2
0
        // Display movie description under watchlist on selected movie
        private void lbxWatchlist_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                WatchedMovies selectMovie = lbxWatchlist.SelectedItem as WatchedMovies;
                if (selectMovie != null)
                {
                    tblkDescription.Text = selectMovie.MovieDescription;
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("There was an error displaying the movie description" + ex.Message);
            }
        }
Exemple #3
0
        // Choosing from a list of all watched movies, and displaying info on selected movie
        private void LbxWatchedAll_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                WatchedMovies selectMovie = lbxWatchedAll.SelectedItem as WatchedMovies;

                tblkMovieList.Text        = selectMovie.MovieName;
                tblkMovieGenre.Text       = selectMovie.MovieGenre;
                tblkMovieDescription.Text = selectMovie.MovieDescription;
                tblkMovieRating.Text      = selectMovie.MovieRating;
                tblkMovieDate.Text        = selectMovie.DateWatched.ToShortDateString();
            }

            catch (Exception ex)
            {
                MessageBox.Show("There was an error displaying the watchlist" + ex.Message);
            }
        }
Exemple #4
0
        // Add movie to watched list from watchlist
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                WatchedMovies selectedMovie = lbxWatchlist.SelectedItem as WatchedMovies;

                if (selectedMovie != null)
                {
                    if (cbxAddRating.SelectedItem != null && DPDateWatched != null)
                    {
                        selectedMovie.MovieRating = cbxAddRating.SelectedItem.ToString();
                        selectedMovie.DateWatched = DPDateWatched.SelectedDate.Value;

                        lbxWatched.ItemsSource    = null;
                        lbxWatched.ItemsSource    = WatchedMovies;
                        lbxWatchedAll.ItemsSource = null;
                        lbxWatched.ItemsSource    = WatchedMovies;
                        AllMovies.Remove(selectedMovie);
                        WatchedMovies.Add(selectedMovie);

                        RefreshScreen();

                        FilterWatchlist.Remove(selectedMovie);
                        lbxWatchlist.ItemsSource = null;
                        lbxWatchlist.ItemsSource = FilterWatchlist;

                        tblkDescription.Text       = "";
                        cbxAddRating.SelectedIndex = 0;
                        DPDateWatched.SelectedDate = null;

                        db.WatchedMovies.Add(selectedMovie);

                        db.SaveChanges();
                    }
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("There was an error adding the movie to the watchlist" + ex.Message);
            }
        }