private void olvDuplicates_CellRightClick(object sender, BrightIdeasSoftware.CellRightClickEventArgs e) { if (e.Model is null) { return; } CollectionMember mlastSelected = (CollectionMember)e.Model; possibleMergedEpisodeRightClickMenu.Items.Clear(); if (mlastSelected.IsInLibrary) { MovieConfiguration?si = mDoc.FilmLibrary.GetMovie(mlastSelected.TmdbCode); if (si != null) { AddRcMenuItem("Force Refresh", (o, args) => mainUi.ForceMovieRefresh(si, false)); AddRcMenuItem("Edit Movie", (o, args) => mainUi.EditMovie(si)); } } else { AddRcMenuItem("Add to Library...", (o, args) => AddToLibrary(mlastSelected.Movie)); } //possibleMergedEpisodeRightClickMenu.Items.Add(new ToolStripSeparator()); }
private void BwScan_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker bw = (BackgroundWorker)sender; List <(int, string)> collectionIds = mDoc.FilmLibrary.Values .Select(c => (c.CachedMovie?.CollectionId, c.CachedMovie?.CollectionName)) .Where(a => a.CollectionId.HasValue && a.CollectionName.HasValue()) .Select(a => (a.CollectionId.Value, a.CollectionName)).Distinct().ToList(); int total = collectionIds.Count; int current = 0; collectionMovies.Clear(); foreach ((int collectionId, var collectionName) in collectionIds) { Dictionary <int, CachedMovieInfo> shows = TMDB.LocalCache.Instance.GetMovieIdsFromCollection(collectionId); foreach (KeyValuePair <int, CachedMovieInfo> neededShow in shows) { CollectionMember c = new CollectionMember { CollectionName = collectionName, Movie = neededShow.Value }; c.IsInLibrary = mDoc.FilmLibrary.ContainsKey(c.TmdbCode); collectionMovies.Add(c); } bw.ReportProgress(100 * current++ / total, collectionName); } }
private void BwScan_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker bw = (BackgroundWorker)sender; List <(int, string)> collectionIds = mDoc.FilmLibrary.Collections; int total = collectionIds.Count; int current = 0; collectionMovies.Clear(); foreach ((int collectionId, var collectionName) in collectionIds) { Dictionary <int, CachedMovieInfo> shows = TMDB.LocalCache.Instance.GetMovieIdsFromCollection(collectionId, TVSettings.Instance.TMDBLanguage); foreach (KeyValuePair <int, CachedMovieInfo> neededShow in shows) { CollectionMember c = new CollectionMember { CollectionName = collectionName, Movie = neededShow.Value }; c.IsInLibrary = mDoc.FilmLibrary.Movies.Any(configuration => configuration.TmdbCode == c.TmdbCode); collectionMovies.Add(c); } bw.ReportProgress(100 * current++ / total, collectionName); } }