private void FormOptions_Load(object sender, EventArgs e) { comboBoxWatchedAfter.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxWatchedAfter.Items.Clear(); comboBoxWatchedAfter.Items.Add(1); comboBoxWatchedAfter.Items.Add(5); comboBoxWatchedAfter.Items.Add(10); comboBoxWatchedAfter.Items.Add(15); int watchedAfter; if (Config.settings.watchedAfter == 0) { watchedAfter = 1; } else { watchedAfter = (int)Math.Floor((decimal)Config.settings.watchedAfter / 60); switch (watchedAfter) { case 1: case 5: case 10: case 15: break; default: watchedAfter = 1; break; } } try { // update MyFormField.SetCheckBoxChecked(checkBoxCreateMB, Config.settings.createMB); MyFormField.SetCheckBoxChecked(checkBoxCreateMVE, Config.settings.createMVE); MyFormField.SetCheckBoxChecked(checkBoxCreateXBMC, Config.settings.createXBMC); MyFormField.SetCheckBoxChecked(checkBoxUpdateMB, Config.settings.updateMB); MyFormField.SetCheckBoxChecked(checkBoxUpdateXBMC, Config.settings.updateXBMC); MyFormField.SetCheckBoxChecked(checkBoxMarkWatched, Config.settings.markWatched); MyFormField.SetComboBoxValue(comboBoxWatchedAfter, watchedAfter); ValidateMarkWatched(); // gallery MyFormField.SetCheckBoxChecked(checkBoxEnableGallery, Config.settings.gallery.enable); ToggleGalleryEnabled(); labelGalleryBackColor.Text = ""; labelGalleryBackColor.BackColor = Config.settings.gallery.backColor; MyFormField.SetCheckBoxChecked(checkBoxEnableGalleryCache, Config.settings.gallery.cachePosterThumbnails); } catch (Exception ex2) { MyLog.Add(ex2.ToString()); } }
public void SetWatched() { // set watched try { selectedVideoInfo.videoItem.watched = "YES"; MyFormField.SetCheckBoxChecked(checkBoxWatched, true); } catch (Exception e) { MyLog.Add(e.ToString()); } // set last played try { selectedVideoInfo.videoItem.lastPlayed = DateTime.UtcNow; MyFormField.SetLabelText(labelLastPlayed, selectedVideoInfo.videoItem.lastPlayed); } catch (Exception e) { MyLog.Add(e.ToString()); } // increment play count try { if (comboBoxPlayCount.Text == "") { comboBoxPlayCount.Text = "0"; } int playCount = Convert.ToInt32(comboBoxPlayCount.Text) + 1; selectedVideoInfo.videoItem.playCount = playCount; MyFormField.SetComboBoxValue(comboBoxPlayCount, selectedVideoInfo.videoItem.playCount); } catch (Exception e) { MyLog.Add(e.ToString()); } }
public void SetForm(VideoInfo videoInfo) { this.selectedVideoInfo = videoInfo; VideoItem videoItem = videoInfo.videoItem; try { // set search title MyFormField.SetTextBoxText(textBoxTitle, videoItem.title); // set movie set MyFormField.SetTextBoxText(textBoxMovieSet, videoItem.movieset); // set plot MyFormField.SetRichTextBoxText(richTextBoxPlot, videoItem.plot); // set runtime MyFormField.SetTextBoxText(textBoxRunTime, videoItem.runtime.ToString()); // set tagline // MyFormField.SetTextBoxText(textBoxTagLine, videoItem.tagline); // not yet // set notes MyFormField.SetRichTextBoxText(richTextBoxNotes, videoItem.notes); if (videoItem.encoding != null) { // set width if (videoItem.encoding.width > 0) { MyFormField.SetTextBoxText(textBoxWidth, videoItem.encoding.width.ToString()); } else { MyFormField.SetTextBoxText(textBoxWidth, ""); } // set height if (videoItem.encoding.height > 0) { MyFormField.SetTextBoxText(textBoxHeight, videoItem.encoding.height.ToString()); } else { MyFormField.SetTextBoxText(textBoxHeight, ""); } // set bitrate if (videoItem.encoding.bitrate > 0) { MyFormField.SetTextBoxText(textBoxBitrate, videoItem.encoding.bitrate.ToString()); string bitrateFormatted = MyFile.FormatSize(videoItem.encoding.bitrate, 2); bitrateFormatted = bitrateFormatted.Replace(" ", "\n"); MyFormField.SetLabelText(labelForBitrateFormatted, bitrateFormatted); } else { MyFormField.SetTextBoxText(textBoxBitrate, ""); MyFormField.SetLabelText(labelForBitrateFormatted, ""); } // set codec if (!String.IsNullOrEmpty(videoItem.encoding.codec)) { MyFormField.SetComboBoxValue(comboBoxCodec, videoItem.encoding.codec); } else { MyFormField.SetComboBoxValue(comboBoxCodec, ""); } } // set tag for (int index = dataGridViewTags.Rows.Count - 1; index >= 0; index--) { if (dataGridViewTags.Rows[index].IsNewRow) { continue; } dataGridViewTags.Rows.RemoveAt(index); } if (videoItem.tags != null) { IComparer <VideoItemTag <string> > sortVideoItemTag = new SortVideoItemTag(); videoItem.tags.Sort(sortVideoItemTag); foreach (VideoItemTag <string> tag in videoItem.tags) { dataGridViewTags.Rows.Add(new object[] { tag.name }); } // prevent add row from being auto selected if (dataGridViewTags.CurrentCell != null) { dataGridViewTags.CurrentCell.Selected = false; } } // set genre for (int index = dataGridViewGenres.Rows.Count - 1; index >= 0; index--) { if (dataGridViewGenres.Rows[index].IsNewRow) { continue; } dataGridViewGenres.Rows.RemoveAt(index); } if (videoItem.genres != null) { IComparer <VideoItemGenre <string> > sortVideoItemGenre = new SortVideoItemGenre(); videoItem.genres.Sort(sortVideoItemGenre); foreach (VideoItemGenre <string> genre in videoItem.genres) { dataGridViewGenres.Rows.Add(new object[] { genre.name }); } // prevent add row from being auto selected if (dataGridViewGenres.CurrentCell != null) { dataGridViewGenres.CurrentCell.Selected = false; } } // set bing link SetLinkLabelFromTitle(linkLabelBing, "https://www.bing.com/search?q="); // set google link SetLinkLabelFromTitle(linkLabelGoogle, "https://www.google.com/search?q="); // set google link SetLinkLabelFromTitle(linkLabelRT, "https://www.rottentomatoes.com/search/?search="); // set upc MyFormField.SetTextBoxText(textBoxUPC, videoItem.upc); // set tmdbId link MyFormField.SetTextBoxText(textBoxTMDB, videoItem.tmdbId); MyFormField.SetLinkLabel(linkLabelTMDB, "http://www.themoviedb.org/movie/", videoItem.tmdbId); // set imdbId link MyFormField.SetTextBoxText(textBoxIMDB, videoItem.imdbId); MyFormField.SetLinkLabel(linkLabelIMDB, "http://www.imdb.com/title/", videoItem.imdbId); // set year MyFormField.SetComboBoxValue(comboBoxYear, videoItem.year); // set imdbRating MyFormField.SetComboBoxValue(comboBoxIMDBRating, Convert.ToInt32(videoItem.imdbRating)); // set mpaa MyFormField.SetComboBoxValue(comboBoxMPAA, videoItem.mpaa); // set playCount MyFormField.SetComboBoxValue(comboBoxPlayCount, videoItem.playCount); // set rating MyFormField.SetComboBoxValue(comboBoxRating, videoItem.rating); // set source MyFormField.SetComboBoxValue(comboBoxSource, videoItem.source); // set version MyFormField.SetComboBoxValue(comboBoxVersion, videoItem.version); // set lastPlayed MyFormField.SetLabelText(labelLastPlayed, videoItem.lastPlayed); // set labelUpdated MyFormField.SetLabelText(labelUpdated, videoInfo.updated); // set watched MyFormField.SetCheckBoxChecked(checkBoxWatched, ((videoItem.watched != "NO") ? true : false)); // set actor/director for (int index = dataGridViewActors.Rows.Count - 1; index >= 0; index--) { if (dataGridViewActors.Rows[index].IsNewRow) { continue; } dataGridViewActors.Rows.RemoveAt(index); } if (videoItem.directors != null) { IComparer <VideoItemDirector <string> > sortVideoItemDirector = new SortVideoItemDirector(); videoItem.directors.Sort(sortVideoItemDirector); foreach (VideoItemDirector <string> director in videoItem.directors) { dataGridViewActors.Rows.Add(new object[] { director.name, "Director" }); } } if (videoItem.actors != null) { IComparer <VideoItemActor <string, string> > sortVideoItemActor = new SortVideoItemActor(); videoItem.actors.Sort(sortVideoItemActor); foreach (VideoItemActor <string, string> actor in videoItem.actors) { dataGridViewActors.Rows.Add(new object[] { actor.name, actor.role }); } } // prevent add row from being auto selected if (dataGridViewActors.CurrentCell != null) { dataGridViewActors.CurrentCell.Selected = false; } } catch (Exception e) { MyLog.Add(e.ToString()); } this.Parent.Focus(); }