//transfers to movie from want to watched based on index public void TransferWatched(string review, double rating, int index) { WatchedMovie watchedmovie = new WatchedMovie(); watchedmovie.Title = wantMovieList[index].Title; watchedmovie.Comments = wantMovieList[index].Comments; watchedmovie.Genre = wantMovieList[index].Genre; watchedmovie.Review = review; watchedmovie.Rating = rating; watchedMovieList.Add(watchedmovie); wantMovieList.RemoveAt(index); printWantMovieList(); printWatchedMovieList(); DisableButtons1(); DisableButtons2(); setModifiedState(); TabControl.SelectedIndex = 1; }
//add movie on watched movie page private void Add_Movie_Click2(object sender, RoutedEventArgs e) { WatchedMovie movie = new WatchedMovie(); bool worked = true; try { movie.Title = Title_Textbox2.Text; if (Title_Textbox2.Text == "") { System.FormatException fEx = new System.FormatException(); throw fEx; } } catch (FormatException) { Title_Textbox.BorderBrush = Brushes.Red; worked = false; } try { double rating = double.Parse(Rating.Text); movie.Rating = rating; if (rating < 0 || rating >= 10) { System.FormatException fEx = new System.FormatException(); throw fEx; } } catch (FormatException) { Rating.BorderBrush = Brushes.Red; worked = false; } ComboBoxItem cbi = (ComboBoxItem)GenreComboBox2.SelectedItem; movie.Genre = cbi.Content.ToString(); if (worked == true) { watchedMovieList.Add(movie); Title_Textbox.BorderBrush = SystemColors.ControlDarkBrush; Rating.BorderBrush = SystemColors.ControlDarkBrush; Title_Textbox2.Text = ""; Rating.Text = ""; GenreComboBox.Text = "Genre"; setModifiedState(); int skip = 0; SkipList2.Clear(); MoviesListView2.Items.Clear(); foreach (WatchedMovie movie2 in watchedMovieList) { try { if (movie2.Title.ToUpper().Contains(Search2.Text.ToUpper()) || Search2.Text == "") { if (Favorite_cb.IsChecked == true) { if (movie2.Favorite == "*") { MoviesListView2.Items.Add(new WatchedMovie { Title = movie2.Title, Genre = movie2.Genre, Rating = movie2.Rating, DateAdded = movie2.DateAdded, Favorite = movie2.Favorite }); SkipList2.Add(skip); } } else { MoviesListView2.Items.Add(new WatchedMovie { Title = movie2.Title, Genre = movie2.Genre, Rating = movie2.Rating, DateAdded = movie2.DateAdded, Favorite = movie2.Favorite }); SkipList2.Add(skip); } } else { skip++; } } catch { } } CheckSort2(); } }