コード例 #1
0
ファイル: MainWindow.cs プロジェクト: Tonaplo/MovieCatalogue
        /// <summary>
        /// This function describes what happens when you click the EditButton. It lets you edit the selected Movie.
        /// </summary>
        private void EditButton_Click(object sender, EventArgs e)
        {
            Movie editedMovie = null;

            editedMovie = (Movie)listBoxTitle.SelectedItem;

            AddMovieForm editMovieForm;

            if (editedMovie != null)
                editMovieForm = new AddMovieForm(editedMovie);
            else
            {
                editMovieForm = new AddMovieForm();
                MissingInfoForm noMovie = new MissingInfoForm("You have not selected a movie!");
                noMovie.ShowDialog();
                //AddMovieButton_Click(null, null);
                return;
            }

            if (editMovieForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                changesMade = true;
                editedMovie.Title = editMovieForm.Title;
                editedMovie.Year = editMovieForm.Year;
                editedMovie.Genres = editMovieForm.Genres;
                editedMovie.Description = editMovieForm.Description;
                editedMovie.ActorList.Clear();
                editedMovie.ActorList.AddRange(editMovieForm.ActorsInMovie);
                editedMovie.Country = editMovieForm.Country;
                editedMovie.Director = editMovieForm.Director;
                editedMovie.CompendiumNumber = editMovieForm.CompendiumNumber;
                editedMovie.PlayTime = editMovieForm.PlayTime;
                editedMovie.Poster = ImageToBase64(editMovieForm.Poster, System.Drawing.Imaging.ImageFormat.Jpeg);
                editedMovie.LentOut = editMovieForm.LentStatus;
                editedMovie.LendPerson = editMovieForm.LentToPerson;

                SaveLoadDataForm form = new SaveLoadDataForm(true, movieList);
                form.ShowDialog();

                ResetListBoxDisplays();
                SearchInitiated();
            }
        }
コード例 #2
0
ファイル: MainWindow.cs プロジェクト: Tonaplo/MovieCatalogue
        /// <summary>
        /// This function describes what happens when you press the AddMovieButton
        /// </summary>
        private void AddMovieButton_Click(object sender, EventArgs e)
        {
            AddMovieForm newMovieForm = new AddMovieForm();
            if (newMovieForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                changesMade = true;
                movieList.Add(new Movie(newMovieForm.Title, newMovieForm.Year, newMovieForm.Genres, newMovieForm.Description, newMovieForm.ActorsInMovie, newMovieForm.Country, newMovieForm.Director, newMovieForm.CompendiumNumber, newMovieForm.PlayTime, ImageToBase64(newMovieForm.Poster, System.Drawing.Imaging.ImageFormat.Jpeg), newMovieForm.LentStatus, newMovieForm.LentToPerson));

                SaveLoadDataForm form = new SaveLoadDataForm(true, movieList);
                form.ShowDialog();

                ResetListBoxDisplays();
                SearchInitiated();

            }
        }