private void SearchBox_TextChanged(object sender, EventArgs e) { if (SearchBox.Text.Length > 0) { int index = 0; if (Core.Search.ActorSearch(SearchBox.Text, AddMovieAllActorsBox.Items, out index)) { AddMovieAllActorsBox.SelectedIndex = index; } else { MissingInfoForm mif = new MissingInfoForm("There was no actor with that name in the list! Please add the person to the list first!"); mif.ShowDialog(); } } }
void worker_DoWork(object sender, DoWorkEventArgs e) { if (bf.SearchTitle(searchText).Results.Count < 5) moviecount = bf.SearchTitle(searchText).Results.Count; erroresWhileParsing = false; foreach (var main in bf.SearchTitle(searchText).Results) { try { var mainMovie = bf.ReadMain(main.Id); if(mainMovie.MediaType == MediaType.Movie) movieList.Add(AddMovieFromSearch(mainMovie, movieList.Count)); } catch (Exception exp) { if (exp.Message == "File could not be loaded after 3 attempts.") { MissingInfoForm missingInfo = new MissingInfoForm("It seems you are not connected to the Internet. Please check your internet connection."); missingInfo.ShowDialog(); } } if (movieList.Count == 5) break; } SetProgress(100); }
/// <summary> /// This function describes what happens when you click the DoneButton. It check if the info is correct and return the /// info if it is. If it isn't, it'll throw an error message. /// </summary> private void DoneButton_Click(object sender, EventArgs e) { if (this.AddMovieTitleBox.Text == "" || this.AddMovieYearBox.Text == "" || genres.Count == 0 || this.AddMovieDescriptionBox.Text == "" || this.actorsInMovie.Count == 0 || this.AddMovieCountryBox.Text == "" || this.AddMovieDirectorBox.Text == "" || this.numericUpDownCompendium.Value == 0 || this.numericUpDownSpot.Value == 0 || this.AddMoviePlayTimeTextBox.Text == "") { MissingInfoForm missingInfo = new MissingInfoForm("Some infomation is missing! Make sure you have filled out all of the required fields. They are marked with a star!"); missingInfo.ShowDialog(); } else { for(int i = 0; i < actorsInMovie.Count; i++) { if (!CheckActor(actorsInMovie[i], actorList)) { actorList.Add(actorsInMovie[i]); actorDisplayList.Add(actorsInMovie[i]); } } Datahandler.SaveActors("actors.xml", actorList); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } }
private void IMDBSearch_textbox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { if (IMDBSearch_textbox.Text != "") { ProgressForm pform = new ProgressForm(IMDBSearch_textbox.Text); if (pform.ShowDialog() == DialogResult.OK) { IMBDMovieList = pform.MovieList; IMBDPosterList = pform.PosterList; IMBDSearchListBox.DataSource = IMBDMovieList; if (pform.Errores) { MissingInfoForm missingInfo = new MissingInfoForm("Some movie data was not found and might not be shown! Check boxes for the message \"Error!\""); missingInfo.ShowDialog(); } } if (IMBDMovieList.Count == 0) { MissingInfoForm missingInfo = new MissingInfoForm("No movies with the specified title was found! Maybe you miss-spelled the title?"); missingInfo.ShowDialog(); } } else { MissingInfoForm missingInfo = new MissingInfoForm("When using the IMBD search function, make sure you have filled in a Title to search for!"); missingInfo.ShowDialog(); } } }
/// <summary> /// This function describes what happens when you click the WatchMovieButton /// </summary> private void WatchMovieButton_Click(object sender, EventArgs e) { Movie seeThisMovie = new Movie(); seeThisMovie = (Movie)listBoxTitle.SelectedItem; if (seeThisMovie != null) { WatchMovie watchMovieForm = new WatchMovie(seeThisMovie.CompendiumNumber, seeThisMovie.Title); watchMovieForm.ShowDialog(); } else { MissingInfoForm noMovie = new MissingInfoForm("You have not selected a movie!"); noMovie.ShowDialog(); return; } }
private void listBoxTitle_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { Movie seeThisMovie = new Movie(); seeThisMovie = (Movie)listBoxTitle.SelectedItem; if (seeThisMovie != null) { WatchMovie watchMovieForm = new WatchMovie(seeThisMovie.CompendiumNumber, seeThisMovie.Title); watchMovieForm.ShowDialog(); } else { MissingInfoForm noMovie = new MissingInfoForm("You have not selected a movie!"); noMovie.ShowDialog(); return; } } }
/// <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(); } }
/// <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(); }
public static BindingList<Actor> LoadActors(string filename) { string path = filename; BindingList<Actor> t = null; if (System.IO.File.Exists(path)) { TextReader textReader; XmlSerializer deserializer = new XmlSerializer(typeof(BindingList<Actor>)); textReader = new StreamReader(path); try { t = (BindingList<Actor>)deserializer.Deserialize(textReader); } catch (Exception exp) { MissingInfoForm missingInfo = new MissingInfoForm(exp.Message); missingInfo.ShowDialog(); textReader.Close(); } finally { textReader.Close(); } return t; } else return new BindingList<Actor>(); }