public void RefreshControls(MovieTechnicalDetails mtd) { _bsControlsData.DataSource = mtd; _bsControlsData.ResetBindings(false); ttTitleContent.RemoveAll(); if (mtd.HasTitle && !string.IsNullOrEmpty(mtd.Title)) { ttTitleContent.SetToolTip(chbHasEmbeddedTitle, mtd.Title); chbHasEmbeddedTitle.Cursor = Cursors.Help; } else { ttTitleContent.RemoveAll(); chbHasEmbeddedTitle.Cursor = Cursors.Default; } //having it on "InitControls" will cause a crash, the column being NOT recognized! //only for this custom TextBox //todo: why? if (tbSize.DataBindings.Count == 0) { tbSize.DataBindings.Add("Text", _bsControlsData, "FileSize2"); tbSize.ButtonToolTip = "Size mismatch!" + Environment.NewLine + "Possible cause: a previously edited value was provided in a format that couldn't be transformed into a number representation." + Environment.NewLine + "Please revise the FileSize value!"; //todo: copy implementation model from "Movies" } }
private void btnOk_Click(object sender, EventArgs e) { if (tbFileName.Text == string.Empty) { lbFilename.ForeColor = Color.Red; MsgBox.Show("Please specify all required import parameters!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } btnOk.Text = "Working ..."; btnOk.Enabled = false; Cursor.Current = Cursors.WaitCursor; var opRes = FilesMetaData.GetFileTechnicalDetails(_filePath); if (!opRes.Success) { MsgBox.Show(opRes.CustomErrorMessage, "Import", MessageBoxButtons.OK, MessageBoxIcon.Warning); btnOk.Text = "Ok"; btnOk.Enabled = true; Cursor.Current = Cursors.Default; return; } mtd = (MovieTechnicalDetails)opRes.AdditionalDataReturn; mtd.Quality = Desene.DAL.GetQualityStrFromSize(mtd); mtd.AudioLanguages = string.Join(", ", mtd.AudioStreams.Select(a => a.Language == "" ? "?" : a.Language).Distinct()); mtd.SubtitleLanguages = string.Join(", ", mtd.SubtitleStreams.Select(a => a.Language == "" ? "?" : a.Language).Distinct()); if (cbGenerateThumbnails.Checked) { FilesMetaData.GetMovieStills(mtd, null); } if (!_isNew) { mtd.ParentId = Desene.DAL.CurrentMTD.ParentId; mtd.Year = Desene.DAL.CurrentMTD.Year; mtd.Season = Desene.DAL.CurrentMTD.Season; mtd.DescriptionLink = Desene.DAL.CurrentMTD.DescriptionLink; mtd.Recommended = Desene.DAL.CurrentMTD.Recommended; mtd.RecommendedLink = Desene.DAL.CurrentMTD.RecommendedLink; mtd.Theme = Desene.DAL.CurrentMTD.Theme; mtd.Notes = Desene.DAL.CurrentMTD.Notes; mtd.Synopsis = Desene.DAL.CurrentMTD.Synopsis; mtd.Trailer = Desene.DAL.CurrentMTD.Trailer; mtd.StreamLink = Desene.DAL.CurrentMTD.StreamLink; mtd.Poster = Desene.DAL.CurrentMTD.Poster; mtd.InsertedDate = Desene.DAL.CurrentMTD.InsertedDate; mtd.LastChangeDate = DateTime.Now; //CMA: the CurrentMTD will be reset after save //Desene.DAL.CurrentMTD = mtd; } Cursor.Current = Cursors.Default; DialogResult = DialogResult.OK; Close(); }
public void RefreshControls(MovieTechnicalDetails mtd) { try { Cursor = Cursors.WaitCursor; DrawingControl.SuspendDrawing(this); _bsControlsData.DataSource = mtd; _bsControlsData.ResetBindings(false); ttTitleContent.RemoveAll(); if (mtd.HasTitle && !string.IsNullOrEmpty(mtd.Title)) { ttTitleContent.SetToolTip(chbTitle, mtd.Title); chbTitle.Cursor = Cursors.Help; } else { ttTitleContent.SetToolTip(chbTitle, "The file doesn't have a 'Title' tag"); chbTitle.Cursor = Cursors.Default; } //having it on "InitControls" will cause a crash, the column being NOT recognized! //only for this custom TextBox //todo: why? if (tbSize.DataBindings.Count == 0) { tbSize.DataBindings.Add("Text", _bsControlsData, "FileSize2"); } //CheckSizeMismatch(); if (mtd.Id > 0) { var cachedMovieStills = DAL.CachedMoviesStills.FirstOrDefault(ms => ms.FileDetailId == mtd.Id); if (cachedMovieStills != null) { SetMovieStills(cachedMovieStills.MovieStills); } else { cachedMovieStills = DAL.LoadMovieStills(mtd.Id); DAL.CachedMoviesStills.Add(cachedMovieStills); SetMovieStills(cachedMovieStills.MovieStills); } LoadControls2(); } else { SetMovieStills(mtd.MovieStills); } var tt3 = new ToolTip(); //ttTitleContent not working?!! tt3.SetToolTip(bGotoRecommendedSite, mtd.HasRecommendedDataSaved ? "Displays a window showing the last scraped/passed data from CommmonSenseMedia site" : "Navigate using the default system browser to the current CommonSenseMedia link"); _hasRecommendedDataSaved = mtd.HasRecommendedDataSaved; } finally { DrawingControl.ResumeDrawing(this); Cursor = Cursors.Default; } }
public void RefreshControls(MovieTechnicalDetails mtd = null) { _bsControlsData.DataSource = mtd ?? DAL.CurrentMTD; _bsControlsData.ResetBindings(false); }