Exemplo n.º 1
0
        /// <summary>
        /// This function describes what happens when you click the ExitButton. It exits the program
        /// </summary>
        private void ExitButton_Click(object sender, EventArgs e)
        {
            SaveLoadDataForm form = new SaveLoadDataForm(true, movieList);
            form.ShowDialog();

            if (changesMade)
            {
                var result = System.Windows.Forms.MessageBox.Show("It seems you have made some changes to your data! Would if you to export it?",
                    "Data was changed", MessageBoxButtons.YesNo);

                if (result == System.Windows.Forms.DialogResult.Yes)
                    ExportData();
            }

            this.Close();
        }
Exemplo n.º 2
0
        /// <summary>
        /// This function describes what happens when you click the DeleteMovieButton
        /// </summary>
        private void DeleteMovieButton_Click(object sender, EventArgs e)
        {
            Movie toBeDeleted = new Movie();
            if (listBoxTitle.SelectedItem != null)
            {
                changesMade = true;
                toBeDeleted = (Movie)listBoxTitle.SelectedItem;
                movieList.Remove((Movie)listBoxTitle.SelectedItem);
                movieDisplayList.Remove((Movie)listBoxTitle.SelectedItem);
            }
            else
            {
                MissingInfoForm noMovie = new MissingInfoForm("You have not selected a movie!");
                noMovie.ShowDialog();
                return;
            }

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

            ResetLabels();
        }
Exemplo n.º 3
0
        /// <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();
            }
        }
Exemplo n.º 4
0
        /// <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();

            }
        }