void RateSeriesForm_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { AnimeSeriesVM ser = this.DataContext as AnimeSeriesVM; if (ser == null) { return; } cboVoteType.Items.Clear(); cboVoteType.Items.Add(Properties.Resources.VoteTypeAnimeTemporary); if (ser.AniDB_Anime.FinishedAiring) { cboVoteType.Items.Add(Properties.Resources.VoteTypeAnimePermanent); } if (ser.AniDB_Anime.FinishedAiring && ser.AllFilesWatched) { cboVoteType.SelectedIndex = 1; } else { cboVoteType.SelectedIndex = 0; } TraktLinkExists = ser.AniDB_Anime != null && ser.AniDB_Anime.AniDB_AnimeCrossRefs != null && ser.AniDB_Anime.AniDB_AnimeCrossRefs.TraktCrossRefExists; }
public static bool DialogSelectSeries(ref AnimeSeriesVM ser, List <AnimeSeriesVM> seriesList) { //show the selection dialog GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return(false); } dlg.Reset(); dlg.SetHeading("Select Series"); int index = 0; foreach (AnimeSeriesVM serTemp in seriesList) { dlg.Add(serTemp.SeriesName); index++; } dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedLabel < 0) { return(false); } ser = seriesList[dlg.SelectedLabel]; return(true); }
private void BtnSwitchView_Click(object sender, RoutedEventArgs e) { try { AppSettings.DisplaySeriesSimple = false; // check if this control is part of the series container DependencyObject parentObject = VisualTreeHelper.GetParent(this); while (parentObject != null) { parentObject = VisualTreeHelper.GetParent(parentObject); AnimeSeriesContainerControl containerCtrl = parentObject as AnimeSeriesContainerControl; if (containerCtrl != null) { // show the full view AnimeSeriesVM ser = this.DataContext as AnimeSeriesVM; if (ser == null) { return; } AnimeSeries seriesControl = new AnimeSeries(); seriesControl.DataContext = ser; containerCtrl.DataContext = seriesControl; return; } } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public MissingFileVM(JMMServerBinary.Contract_MissingFile contract) { this.EpisodeID = contract.EpisodeID; this.FileID = contract.FileID; this.AnimeID = contract.AnimeID; this.AnimeTitle = contract.AnimeTitle; this.EpisodeNumber = contract.EpisodeNumber; this.EpisodeType = contract.EpisodeType; AnimeSeries = null; if (contract.AnimeSeries != null) AnimeSeries = new AnimeSeriesVM(contract.AnimeSeries); HasSeriesData = AnimeSeries != null; string shortType = ""; switch (EpisodeTypeEnum) { case JMMClient.EpisodeType.Credits: shortType = "C"; break; case JMMClient.EpisodeType.Episode: shortType = ""; break; case JMMClient.EpisodeType.Other: shortType = "O"; break; case JMMClient.EpisodeType.Parody: shortType = "P"; break; case JMMClient.EpisodeType.Special: shortType = "S"; break; case JMMClient.EpisodeType.Trailer: shortType = "T"; break; } EpisodeTypeAndNumber = string.Format("{0}{1}", shortType, EpisodeNumber); }
void AnimeSeriesSimplifiedControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { AnimeSeriesVM ser = this.DataContext as AnimeSeriesVM; if (ser == null) { return; } ucExternalLinks.DataContext = ser; try { PosterWidth = 180; if (ser.AniDB_Anime.UsePosterOnSeries) { string imgName = ser.AniDB_Anime.FanartPathThenPosterPath; if (File.Exists(imgName)) { BitmapDecoder decoder = BitmapDecoder.Create(new Uri(imgName), BitmapCreateOptions.None, BitmapCacheOption.None); BitmapFrame frame = decoder.Frames[0]; PosterWidth = (double)250 * ((double)frame.PixelWidth / (double)frame.PixelHeight); } } } catch (Exception ex) { logger.ErrorException(ex.ToString(), ex); } RefreshData(); }
void cRating_OnRatingValueChangedEvent(RatingValueEventArgs ev) { AnimeSeriesVM ser = this.DataContext as AnimeSeriesVM; if (ser == null) { return; } try { decimal rating = (decimal)ev.RatingValue; int voteType = 1; if (ser.AniDB_Anime.FinishedAiring) { voteType = 2; } JMMServerVM.Instance.VoteAnime(ser.AniDB_ID, rating, voteType); // refresh the data MainListHelperVM.Instance.UpdateHeirarchy(ser); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void SetWatchedStatusOnSeries(bool watchedStatus, int maxEpisodeNumber) { try { AnimeSeriesVM animeSeries = (AnimeSeriesVM)this.DataContext; if (animeSeries == null) { return; } this.Cursor = Cursors.Wait; AnimeEpisodeTypeVM epType = cboEpisodeTypeFilter.SelectedItem as AnimeEpisodeTypeVM; JMMServerVM.Instance.clientBinaryHTTP.SetWatchedStatusOnSeries(animeSeries.AnimeSeriesID.Value, watchedStatus, maxEpisodeNumber, (int)epType.EpisodeType, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); MainListHelperVM.Instance.UpdateHeirarchy(animeSeries); RefreshEpisodes(); this.Cursor = Cursors.Arrow; Window parentWindow = Window.GetWindow(this); Utils.PromptToRateSeries(animeSeries, parentWindow); } catch (Exception ex) { this.Cursor = Cursors.Arrow; Utils.ShowErrorMessage("SetWatchedStatusOnSeries: " + ex.Message); logger.ErrorException(ex.ToString(), ex); } }
public void RefreshEpisodes() { try { AnimeSeriesVM animeSeries = (AnimeSeriesVM)this.DataContext; if (animeSeries == null) { CurrentEpisodes.Clear(); return; } //if (animeSeries.AnimeSeriesID.HasValue && lastAnimeSeriesID == animeSeries.AnimeSeriesID.Value) // return; //else // lastAnimeSeriesID = animeSeries.AnimeSeriesID.Value; CurrentEpisodes.Clear(); foreach (AnimeEpisodeVM ep in animeSeries.AllEpisodes) { if (ep.EpisodeType != (int)episodeType) { continue; } if (AppSettings.Episodes_WatchedStatus != WatchedStatus.All) { if (AppSettings.Episodes_WatchedStatus == WatchedStatus.Watched && ep.IsWatched == 0) { continue; } if (AppSettings.Episodes_WatchedStatus == WatchedStatus.Unwatched && ep.IsWatched == 1) { continue; } } if (AppSettings.Episodes_Availability != AvailableEpisodeType.All) { if (AppSettings.Episodes_Availability == AvailableEpisodeType.Available && ep.LocalFileCount == 0) { continue; } if (AppSettings.Episodes_Availability == AvailableEpisodeType.NoFiles && ep.LocalFileCount > 0) { continue; } } CurrentEpisodes.Add(ep); } HighlightEpisode(); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
void lbSeries_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (lbSeries.Items.Count == 0) { return; } if (lbSeries.SelectedItem == null) { return; } AnimeSeriesVM series = lbSeries.SelectedItem as AnimeSeriesVM; List <AnimeEpisodeVM> eps = series.AllEpisodes; List <SortPropOrFieldAndDirection> sortCriteria = new List <SortPropOrFieldAndDirection>(); sortCriteria.Add(new SortPropOrFieldAndDirection("EpisodeType", false, SortType.eInteger)); sortCriteria.Add(new SortPropOrFieldAndDirection("EpisodeNumber", false, SortType.eInteger)); eps = Sorting.MultiSort <AnimeEpisodeVM>(eps, sortCriteria); cboEpisodes.ItemsSource = eps; if (cboEpisodes.Items.Count > 0) { cboEpisodes.SelectedIndex = 0; } SetConfirmDetails(); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
void cRating_OnRatingValueChangedEvent(RatingValueEventArgs ev) { AnimeSeriesVM ser = this.DataContext as AnimeSeriesVM; if (ser == null) { return; } try { decimal rating = (decimal)ev.RatingValue; int voteType = 1; if (cboVoteType.SelectedItem.ToString() == Properties.Resources.VoteTypeAnimeTemporary) { voteType = 2; } if (cboVoteType.SelectedItem.ToString() == Properties.Resources.VoteTypeAnimePermanent) { voteType = 1; } JMMServerVM.Instance.VoteAnime(ser.AniDB_ID, rating, voteType); // refresh the data MainListHelperVM.Instance.UpdateHeirarchy(ser); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public MissingFileVM(JMMServerBinary.Contract_MissingFile contract) { this.EpisodeID = contract.EpisodeID; this.FileID = contract.FileID; this.AnimeID = contract.AnimeID; this.AnimeTitle = contract.AnimeTitle; this.EpisodeNumber = contract.EpisodeNumber; this.EpisodeType = contract.EpisodeType; AnimeSeries = null; if (contract.AnimeSeries != null) { AnimeSeries = new AnimeSeriesVM(contract.AnimeSeries); } HasSeriesData = AnimeSeries != null; string shortType = ""; switch (EpisodeTypeEnum) { case JMMClient.EpisodeType.Credits: shortType = "C"; break; case JMMClient.EpisodeType.Episode: shortType = ""; break; case JMMClient.EpisodeType.Other: shortType = "O"; break; case JMMClient.EpisodeType.Parody: shortType = "P"; break; case JMMClient.EpisodeType.Special: shortType = "S"; break; case JMMClient.EpisodeType.Trailer: shortType = "T"; break; } EpisodeTypeAndNumber = string.Format("{0}{1}", shortType, EpisodeNumber); }
private void LoadData() { relations.Clear(); mainAnime = null; serMain = null; serMain = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID); if (serMain != null) { mainAnime = serMain.AniDB_Anime; } if (mainAnime == null) { return; } try { relations = mainAnime.RelatedAnimeLinks; } catch (Exception ex) { BaseConfig.MyAnimeLog.Write(ex.ToString()); } }
void episodesWorker_DoWork(object sender, DoWorkEventArgs e) { try { AnimeSeriesVM ser = e.Argument as AnimeSeriesVM; List <JMMServerBinary.Contract_AnimeEpisode> rawEps = JMMServerVM.Instance.clientBinaryHTTP.GetAllUnwatchedEpisodes(ser.AnimeSeriesID.Value, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); int i = 0; foreach (JMMServerBinary.Contract_AnimeEpisode raw in rawEps) { i++; AnimeEpisodeVM ep = new AnimeEpisodeVM(raw); ep.SetTvDBInfo(); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate() { UnwatchedEpisodes.Add(ep); }); if (i == 10) { break; } } } catch (Exception ex) { logger.ErrorException(ex.ToString(), ex); } }
void cboEpisodeTypeFilter_SelectionChanged(object sender, SelectionChangedEventArgs e) { //return; ComboBox cbo = (ComboBox)sender; object obj = cbo.SelectedItem; if (obj == null) { return; } try { AnimeEpisodeTypeVM epType = obj as AnimeEpisodeTypeVM; AnimeSeriesVM animeSeries = (AnimeSeriesVM)this.DataContext; if (animeSeries == null) { return; } episodeType = epType.EpisodeType; RefreshEpisodes(); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void CommandBinding_UseThis(object sender, ExecutedRoutedEventArgs e) { Window parentWindow = Window.GetWindow(this); object obj = e.Parameter; if (obj == null) { return; } try { if (obj.GetType() == typeof(AnimeSeriesVM)) { this.Cursor = Cursors.Wait; AnimeSeriesVM ser = obj as AnimeSeriesVM; SelectedSeriesID = ser.AnimeSeriesID; this.DialogResult = true; this.Close(); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void ShowPosters() { GUIControl.ClearControl(this.GetID, m_Facade.GetID); List <PosterContainer> allPosters = new List <PosterContainer>(); string displayname = ""; AnimeSeriesVM ser = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID); if (ser != null) { displayname = ser.SeriesName; if (ser.CrossRef_AniDB_TvDBV2 != null && ser.CrossRef_AniDB_TvDBV2.Count > 0) { AnimeID = ser.CrossRef_AniDB_TvDBV2[0].AnimeID; } } BaseConfig.MyAnimeLog.Write("ShowPosters for {0} - {1}", displayname, AnimeID); foreach (PosterContainer pstr in ser.AniDB_Anime.AniDB_AnimeCrossRefs.AllPosters) { if (!File.Exists(pstr.FullImagePath)) { continue; } allPosters.Add(pstr); } GUIListItem item = null; foreach (PosterContainer poster in allPosters) { item = new GUIListItem(); item.IconImage = item.IconImageBig = poster.FullImagePath; item.TVTag = poster; item.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected); m_Facade.Add(item); } if (m_Facade.Count > 0) { m_Facade.SelectedListItemIndex = 0; // Work around for Filmstrip not allowing to programmatically select item if (m_Facade.CurrentLayout == GUIFacadeControl.Layout.Filmstrip) { } PosterContainer selectedPoster = m_Facade.SelectedListItem.TVTag as PosterContainer; if (selectedPoster != null) { SetPosterProperties(selectedPoster); } GUIControl.FocusControl(GetID, 50); } }
public void RefreshData() { try { AniDB_AnimeVM anime = null; AnimeSeriesVM animeSeries = (AnimeSeriesVM)this.DataContext; if (animeSeries == null) { RelatedAnimeLinks.Clear(); return; } RelatedAnimeLinks.Clear(); anime = animeSeries.AniDB_Anime; if (anime == null) { return; } List <JMMServerBinary.Contract_AniDB_Anime_Relation> links = JMMServerVM.Instance.clientBinaryHTTP.GetRelatedAnimeLinks(anime.AnimeID, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); List <AniDB_Anime_RelationVM> tempList = new List <AniDB_Anime_RelationVM>(); foreach (JMMServerBinary.Contract_AniDB_Anime_Relation link in links) { AniDB_Anime_RelationVM rel = new AniDB_Anime_RelationVM(); rel.Populate(link); tempList.Add(rel); } List <SortPropOrFieldAndDirection> sortCriteria = new List <SortPropOrFieldAndDirection>(); sortCriteria.Add(new SortPropOrFieldAndDirection("SortPriority", false, SortType.eInteger)); tempList = Sorting.MultiSort <AniDB_Anime_RelationVM>(tempList, sortCriteria); foreach (AniDB_Anime_RelationVM rel in tempList) { RelatedAnimeLinks.Add(rel); } if (RelatedAnimeLinks.Count == 0) { DataExists = false; DataMissing = true; } else { DataExists = true; DataMissing = false; } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void RefreshData() { try { AniDB_AnimeVM anime = null; AnimeSeriesVM animeSeries = (AnimeSeriesVM)this.DataContext; if (animeSeries == null) { SimilarAnimeLinks.Clear(); return; } SimilarAnimeLinks.Clear(); anime = animeSeries.AniDB_Anime; if (anime == null) { return; } List <JMMServerBinary.Contract_AniDB_Anime_Similar> links = JMMServerVM.Instance.clientBinaryHTTP.GetSimilarAnimeLinks(anime.AnimeID, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); List <AniDB_Anime_SimilarVM> tempList = new List <AniDB_Anime_SimilarVM>(); foreach (JMMServerBinary.Contract_AniDB_Anime_Similar link in links) { AniDB_Anime_SimilarVM sim = new AniDB_Anime_SimilarVM(); sim.Populate(link); tempList.Add(sim); } List <SortPropOrFieldAndDirection> sortCriteria = new List <SortPropOrFieldAndDirection>(); sortCriteria.Add(new SortPropOrFieldAndDirection("ApprovalPercentage", true, SortType.eDoubleOrFloat)); tempList = Sorting.MultiSort <AniDB_Anime_SimilarVM>(tempList, sortCriteria); foreach (AniDB_Anime_SimilarVM sim in tempList) { SimilarAnimeLinks.Add(sim); } if (SimilarAnimeLinks.Count == 0) { DataExists = false; DataMissing = true; } else { DataExists = true; DataMissing = false; } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void PopulatePlaylistObjects() { PlaylistObjects.Clear(); if (string.IsNullOrEmpty(this.PlaylistItems)) { return; } string[] items = this.PlaylistItems.Split('|'); foreach (string pitem in items) { string[] parms = pitem.Split(';'); if (parms.Length != 2) { continue; } int objType = -1; int objID = -1; if (!int.TryParse(parms[0], out objType)) { continue; } if (!int.TryParse(parms[1], out objID)) { continue; } if ((PlaylistItemType)objType == PlaylistItemType.AnimeSeries) { // get the series JMMServerBinary.Contract_AnimeSeries serContract = JMMServerVM.Instance.clientBinaryHTTP.GetSeries(objID, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); if (serContract != null) { AnimeSeriesVM ser = new AnimeSeriesVM(serContract); PlaylistObjects.Add(new PlaylistItemVM(this.PlaylistID.Value, PlaylistItemType.AnimeSeries, ser)); } } else { // get the episode JMMServerBinary.Contract_AnimeEpisode epContract = JMMServerVM.Instance.clientBinaryHTTP.GetEpisode(objID, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); if (epContract != null) { AnimeEpisodeVM ep = new AnimeEpisodeVM(epContract); //ep.SetTvDBInfo(); PlaylistObjects.Add(new PlaylistItemVM(this.PlaylistID.Value, PlaylistItemType.Episode, ep)); } } } SetDependendProperties(); }
public void PopulateSeries(JMMServerBinary.Contract_AnimeSeries seriesContract) { if (seriesContract != null) { AnimeSeries = new AnimeSeriesVM(seriesContract); } EvaluateProperties(); }
public void Init(AnimeSeriesVM series) { Series = series; MainListHelperVM.Instance.ViewGroupsForms.Filter = GroupSearchFilter; MainListHelperVM.Instance.SetGroupFilterSortingOnForms(null); txtGroupName.Text = Series.SeriesName; txtGroupSortName.Text = Series.SeriesName; }
public bool EvaluateSeries(AnimeSeriesVM ser) { // make sure the user has not filtered this out if (!string.IsNullOrEmpty(JMMServerVM.Instance.CurrentUser.HideCategories)) { return(EvaluateCategoryString(ser.CategoriesString)); } return(true); }
private void ShowFanart() { GUIControl.ClearControl(this.GetID, m_Facade.GetID); List <FanartContainer> allFanart = new List <FanartContainer>(); AnimeSeriesVM ser = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID); if (ser != null) { if (ser.CrossRef_AniDB_TvDBV2 != null && ser.CrossRef_AniDB_TvDBV2.Count > 0) { AnimeID = ser.CrossRef_AniDB_TvDBV2[0].AnimeID; } } if (ser == null) { return; } BaseConfig.MyAnimeLog.Write("ShowFanart for {0}", AnimeID); GUIListItem item = null; foreach (FanartContainer fanart in ser.AniDB_Anime.AniDB_AnimeCrossRefs.AllFanarts) { if (!File.Exists(fanart.FullImagePath)) { continue; } item = new GUIListItem(); item.IconImage = item.IconImageBig = fanart.FullThumbnailPath; item.TVTag = fanart; item.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected); m_Facade.Add(item); } if (m_Facade.Count > 0) { m_Facade.SelectedListItemIndex = 0; // Work around for Filmstrip not allowing to programmatically select item if (m_Facade.CurrentLayout == GUIFacadeControl.Layout.Filmstrip) { } FanartContainer selectedFanart = m_Facade.SelectedListItem.TVTag as FanartContainer; if (selectedFanart != null) { setFanartPreviewBackground(selectedFanart); } GUIControl.FocusControl(GetID, 50); } }
private void LoadInfo() { if (MainWindow.GlobalSeriesID > 0) { serMain = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID); if (serMain != null) { MainAnime = serMain.AniDB_Anime; } } }
private bool SeriesSearchFilter(object obj) { AnimeSeriesVM servm = obj as AnimeSeriesVM; if (servm == null) { return(true); } return(GroupSearchFilterHelper.EvaluateSeriesTextSearch(servm, txtSeriesSearch.Text)); }
void refreshCommentsRecsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { AnimeSeriesVM animeSeries = (AnimeSeriesVM)this.DataContext; if (animeSeries == null) { return; } commentsWorker.RunWorkerAsync(animeSeries); }
public Fanart(object fanartObject) { this.fileName = ""; List <string> allFanarts = new List <string>(); // check for a default fanart if (fanartObject.GetType() == typeof(AnimeGroupVM)) { AnimeGroupVM grp = fanartObject as AnimeGroupVM; if (grp.DefaultAnimeSeriesID.HasValue) { AnimeSeriesVM ser = grp.DefaultSeries; if (ser != null) { AniDB_AnimeVM anime = ser.AniDB_Anime; allFanarts.AddRange(GetFanartFilenames(anime)); } } else { // get all the series for this group foreach (AnimeSeriesVM ser in grp.AllSeries) { AniDB_AnimeVM anime = ser.AniDB_Anime; allFanarts.AddRange(GetFanartFilenames(anime)); } } } else if (fanartObject.GetType() == typeof(AnimeSeriesVM)) { AnimeSeriesVM ser = fanartObject as AnimeSeriesVM; AniDB_AnimeVM anime = ser.AniDB_Anime; allFanarts.AddRange(GetFanartFilenames(anime)); } else if (fanartObject.GetType() == typeof(AniDB_AnimeVM)) { AniDB_AnimeVM anime = fanartObject as AniDB_AnimeVM; allFanarts.AddRange(GetFanartFilenames(anime)); } string randomFanart = ""; if (allFanarts.Count > 0) { randomFanart = allFanarts[fanartRandom.Next(0, allFanarts.Count)]; } if (!String.IsNullOrEmpty(randomFanart)) { fileName = randomFanart; } }
public TraktSeriesData(AnimeSeriesVM ser) { AnimeSeriesID = ser.AnimeSeriesID.Value; AnimeID = ser.AniDB_ID; SeriesName = ser.SeriesName; Status = ""; UserTraktLinks = new ObservableCollection <CrossRef_AniDB_TraktVMV2>(); CommTraktLinks = new ObservableCollection <CrossRef_AniDB_TraktVMV2>(); SetHasTraktLinkImage(); }
public static bool EvaluateSeriesTextSearch(AnimeSeriesVM series, string filterText, SeriesSearchType searchType) { if (String.IsNullOrEmpty(filterText) || series == null) return true; if (!string.IsNullOrEmpty(series.SeriesNameOverride)) { int index = series.SeriesNameOverride.IndexOf(filterText, 0, StringComparison.InvariantCultureIgnoreCase); if (index > -1) return true; } return EvaluateAnimeTextSearch(series.AniDB_Anime, filterText, searchType); }
public void Populate(JMMServerBinary.Contract_AnimeRating contract) { this.AnimeID = contract.AnimeID; this.AnimeDetailed = new AniDB_AnimeDetailedVM(); this.AnimeDetailed.Populate(contract.AnimeDetailed, AnimeID); if (contract.AnimeSeries != null) this.AnimeSeries = new AnimeSeriesVM(contract.AnimeSeries); AnimeName = AnimeDetailed.AniDB_Anime.MainTitle; Rating = String.Format("{0:0.00}", AnimeDetailed.AniDB_Anime.AniDBRating); UserRating = AnimeDetailed.UserRating; Year = AnimeDetailed.AniDB_Anime.BeginYear; }
void btnRefreshComments_Click(object sender, RoutedEventArgs e) { AnimeSeriesVM animeSeries = (AnimeSeriesVM)this.DataContext; if (animeSeries == null) { return; } IsLoadingComments = true; refreshCommentsRecsWorker.RunWorkerAsync(animeSeries); }
private void RefreshUnwatchedEpisodes() { AnimeSeriesVM ser = this.DataContext as AnimeSeriesVM; if (ser == null) { return; } if (!episodesWorker.IsBusy) { episodesWorker.RunWorkerAsync(ser); } }
void recsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { AnimeSeriesVM ser = this.DataContext as AnimeSeriesVM; if (ser == null) { return; } if (!charWorker.IsBusy) { charWorker.RunWorkerAsync(ser); } }
public TraktSeriesData(AnimeSeriesVM ser) { AnimeSeriesID = ser.AnimeSeriesID.Value; AnimeID = ser.AniDB_ID; SeriesName = ser.SeriesName; Status = ""; UserTraktLinks = new ObservableCollection<CrossRef_AniDB_TraktVMV2>(); CommTraktLinks = new ObservableCollection<CrossRef_AniDB_TraktVMV2>(); SetHasTraktLinkImage(); }
private void SetAttachedSeries(AnimeSeriesVM ser) { try { HasAttachedSeries = ser != null; if (ser == null) { this.DataContext = null; this.ucFileSummary.DataContext = null; return; } this.DataContext = ser; this.ucFileSummary.DataContext = ser.AniDB_Anime; List<GroupVideoQualityVM> vidQuals = new List<GroupVideoQualityVM>(this.ucFileSummary.VideoQualityRecords); ShowSubGroupSuggestions(vidQuals); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void CommandBinding_ShowPinnedSeries(object sender, ExecutedRoutedEventArgs e) { //object obj = lbGroupsSeries.SelectedItem; object obj = e.Parameter; if (obj == null) return; try { if (obj.GetType() == typeof(AnimeEpisodeVM)) { AnimeEpisodeVM ep = (AnimeEpisodeVM)obj; if (MainListHelperVM.Instance.AllSeriesDictionary.ContainsKey(ep.AnimeSeriesID)) { ShowPinnedSeries(MainListHelperVM.Instance.AllSeriesDictionary[ep.AnimeSeriesID]); } } if (obj.GetType() == typeof(AnimeSeriesVM)) { AnimeSeriesVM ser = (AnimeSeriesVM)obj; ShowPinnedSeries(ser); } if (obj.GetType() == typeof(AniDB_Anime_SimilarVM)) { AniDB_Anime_SimilarVM sim = (AniDB_Anime_SimilarVM)obj; ShowPinnedSeries(sim.AnimeSeries); } if (obj.GetType() == typeof(AniDB_Anime_RelationVM)) { AniDB_Anime_RelationVM rel = (AniDB_Anime_RelationVM)obj; ShowPinnedSeries(rel.AnimeSeries); } if (obj.GetType() == typeof(RecommendationVM)) { RecommendationVM rec = (RecommendationVM)obj; ShowPinnedSeries(rec.Recommended_AnimeSeries); } if (obj.GetType() == typeof(MissingFileVM)) { MissingFileVM mis = (MissingFileVM)obj; ShowPinnedSeries(mis.AnimeSeries); } if (obj.GetType() == typeof(MissingEpisodeVM)) { MissingEpisodeVM misEp = (MissingEpisodeVM)obj; ShowPinnedSeries(misEp.AnimeSeries); } if (obj.GetType() == typeof(PlaylistItemVM)) { PlaylistItemVM pli = (PlaylistItemVM)obj; if (pli.ItemType == PlaylistItemType.AnimeSeries) ShowPinnedSeries(pli.PlaylistItem as AnimeSeriesVM); if (pli.ItemType == PlaylistItemType.Episode) { AnimeEpisodeVM ep = pli.PlaylistItem as AnimeEpisodeVM; if (MainListHelperVM.Instance.AllSeriesDictionary.ContainsKey(ep.AnimeSeriesID)) ShowPinnedSeries(MainListHelperVM.Instance.AllSeriesDictionary[ep.AnimeSeriesID]); } } if (obj.GetType() == typeof(Trakt_ActivityScrobbleVM)) { Trakt_ActivityScrobbleVM scrobble = (Trakt_ActivityScrobbleVM)obj; if (!scrobble.Episode.AnimeSeriesID.HasValue) return; JMMServerBinary.Contract_AnimeSeries contract = JMMServerVM.Instance.clientBinaryHTTP.GetSeries(scrobble.Episode.AnimeSeriesID.Value, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); if (contract == null) return; AnimeSeriesVM ser = new AnimeSeriesVM(contract); ShowPinnedSeries(ser); } if (obj.GetType() == typeof(Trakt_ActivityShoutEpisodeVM)) { Trakt_ActivityShoutEpisodeVM shoutEpisode = (Trakt_ActivityShoutEpisodeVM)obj; if (!shoutEpisode.Shout.AnimeSeriesID.HasValue) return; JMMServerBinary.Contract_AnimeSeries contract = JMMServerVM.Instance.clientBinaryHTTP.GetSeries(shoutEpisode.Shout.AnimeSeriesID.Value, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); if (contract == null) return; AnimeSeriesVM ser = new AnimeSeriesVM(contract); ShowPinnedSeries(ser); } if (obj.GetType() == typeof(Trakt_ActivityShoutShowVM)) { Trakt_ActivityShoutShowVM shoutShow = (Trakt_ActivityShoutShowVM)obj; if (!shoutShow.Shout.AnimeSeriesID.HasValue) return; JMMServerBinary.Contract_AnimeSeries contract = JMMServerVM.Instance.clientBinaryHTTP.GetSeries(shoutShow.Shout.AnimeSeriesID.Value, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); if (contract == null) return; AnimeSeriesVM ser = new AnimeSeriesVM(contract); ShowPinnedSeries(ser); } if (obj.GetType() == typeof(AnimeSearchVM)) { AnimeSearchVM search = (AnimeSearchVM)obj; if (!search.AnimeSeriesID.HasValue) return; JMMServerBinary.Contract_AnimeSeries contract = JMMServerVM.Instance.clientBinaryHTTP.GetSeries(search.AnimeSeriesID.Value, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); if (contract == null) return; AnimeSeriesVM ser = new AnimeSeriesVM(contract); ShowPinnedSeries(ser); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void PopulateSeries(JMMServerBinary.Contract_AnimeSeries seriesContract) { if (seriesContract != null) AnimeSeries = new AnimeSeriesVM(seriesContract); EvaluateProperties(); }
public static bool EvaluateSeriesTextSearch(AnimeSeriesVM series, string filterText) { return EvaluateSeriesTextSearch(series, filterText, SeriesSearchType.Everything); }
public void ShowPinnedSeries(AnimeSeriesVM series, bool isMetroDash = false) { this.Cursor = Cursors.Wait; CloseableTabItem cti = new CloseableTabItem(); //TabItem cti = new TabItem(); // if the pinned tab already has this, don't open it again. int curTab = -1; foreach (object obj in tabPinned.Items) { curTab++; CloseableTabItem ctiTemp = obj as CloseableTabItem; if (ctiTemp == null) continue; AnimeSeriesVM ser = null; ContentControl ctrl = ctiTemp.Content as AnimeSeriesContainerControl; if (ctrl == null) { ContentControl subControl = ctrl.Content as AnimeSeriesSimplifiedControl; if (subControl == null) subControl = ctrl.Content as AnimeSeries; if (subControl != null) ctrl = subControl; } else { ContentControl subControl = ctrl.DataContext as AnimeSeriesSimplifiedControl; if (subControl == null) subControl = ctrl.DataContext as AnimeSeries; if (subControl != null) ctrl = subControl; } if (ctrl == null) continue; ser = ctrl.DataContext as AnimeSeriesVM; if (ser == null) continue; if (ser.AnimeSeriesID == series.AnimeSeriesID) { tabControl1.SelectedIndex = TAB_MAIN_Pinned; tabPinned.SelectedIndex = curTab; this.Cursor = Cursors.Arrow; return; } } string tabHeader = series.SeriesName; if (tabHeader.Length > 30) tabHeader = tabHeader.Substring(0, 30) + "..."; cti.Header = tabHeader; if (AppSettings.DisplaySeriesSimple) { AnimeSeriesSimplifiedControl ctrl = new AnimeSeriesSimplifiedControl(); ctrl.DataContext = series; AnimeSeriesContainerControl cont = new AnimeSeriesContainerControl(); cont.IsMetroDash = false; cont.DataContext = ctrl; cti.Content = cont; tabPinned.Items.Add(cti); } else { AnimeSeries seriesControl = new AnimeSeries(); seriesControl.DataContext = series; AnimeSeriesContainerControl cont = new AnimeSeriesContainerControl(); cont.IsMetroDash = false; cont.DataContext = seriesControl; cti.Content = cont; tabPinned.Items.Add(cti); } tabControl1.SelectedIndex = TAB_MAIN_Pinned; tabPinned.SelectedIndex = tabPinned.Items.Count - 1; this.Cursor = Cursors.Arrow; }
private void CommandBinding_ShowPinnedSeries(object sender, ExecutedRoutedEventArgs e) { //object obj = lbGroupsSeries.SelectedItem; object obj = e.Parameter; if (obj == null) return; try { int? objID = null; if (obj.GetType() == typeof(AnimeEpisodeVM)) { AnimeEpisodeVM ep = (AnimeEpisodeVM)obj; objID = ep.AnimeSeriesID; } if (obj.GetType() == typeof(AnimeSeriesVM)) { AnimeSeriesVM ser = (AnimeSeriesVM)obj; objID = ser.AnimeSeriesID; } if (obj.GetType() == typeof(AniDB_Anime_SimilarVM)) { AniDB_Anime_SimilarVM sim = (AniDB_Anime_SimilarVM)obj; objID = sim.AnimeSeries.AnimeSeriesID; } if (obj.GetType() == typeof(AniDB_Anime_RelationVM)) { AniDB_Anime_RelationVM rel = (AniDB_Anime_RelationVM)obj; objID = rel.AnimeSeries.AnimeSeriesID; } if (obj.GetType() == typeof(RecommendationVM)) { RecommendationVM rec = (RecommendationVM)obj; objID = rec.Recommended_AnimeSeries.AnimeSeriesID; } if (obj.GetType() == typeof(MissingFileVM)) { MissingFileVM mis = (MissingFileVM)obj; objID = mis.AnimeSeries.AnimeSeriesID; } if (obj.GetType() == typeof(MissingEpisodeVM)) { MissingEpisodeVM misEp = (MissingEpisodeVM)obj; objID = misEp.AnimeSeries.AnimeSeriesID; } if (obj.GetType() == typeof(PlaylistItemVM)) { PlaylistItemVM pli = (PlaylistItemVM)obj; if (pli.ItemType == PlaylistItemType.AnimeSeries) { var ser = (AnimeSeriesVM)pli.PlaylistItem; objID = ser.AnimeSeriesID; } else if (pli.ItemType == PlaylistItemType.Episode) { AnimeEpisodeVM ep = pli.PlaylistItem as AnimeEpisodeVM; objID = ep.AnimeSeriesID; } } if (obj.GetType() == typeof(AnimeSearchVM)) { AnimeSearchVM search = (AnimeSearchVM)obj; objID = search.AnimeSeriesID; } if (obj.GetType() == typeof(TraktSeriesData)) { TraktSeriesData trakt = (TraktSeriesData)obj; objID = trakt.AnimeSeriesID; } if (objID != null) { var valObjID = objID.Value; AnimeSeriesVM ser; if (MainListHelperVM.Instance.AllSeriesDictionary.TryGetValue(valObjID, out ser) == false) { // get the series JMMServerBinary.Contract_AnimeSeries serContract = JMMServerVM.Instance.clientBinaryHTTP.GetSeries(valObjID, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); if (serContract != null) { ser = new AnimeSeriesVM(serContract); MainListHelperVM.Instance.AllSeriesDictionary[valObjID] = ser; } } if (ser != null) ShowPinnedSeries(ser); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public static bool EvaluateGroupFilter(GroupFilterVM gf, AnimeSeriesVM ser) { return gf.EvaluateGroupFilter(ser); }
public void Init() { rbGroup.IsChecked = true; rbSeries.IsChecked = false; AllGroups = new ObservableCollection<AnimeGroupVM>(); AllSeries = new ObservableCollection<AnimeSeriesVM>(); try { ViewGroups = CollectionViewSource.GetDefaultView(AllGroups); ViewGroups.SortDescriptions.Add(new SortDescription("SortName", ListSortDirection.Ascending)); ViewSeries = CollectionViewSource.GetDefaultView(AllSeries); ViewSeries.SortDescriptions.Add(new SortDescription("SeriesName", ListSortDirection.Ascending)); List<JMMServerBinary.Contract_AnimeGroup> grpsRaw = JMMServerVM.Instance.clientBinaryHTTP.GetAllGroups(JMMServerVM.Instance.CurrentUser.JMMUserID.Value); foreach (JMMServerBinary.Contract_AnimeGroup grp in grpsRaw) { AnimeGroupVM grpNew = new AnimeGroupVM(grp); AllGroups.Add(grpNew); } List<JMMServerBinary.Contract_AnimeSeries> sersRaw = JMMServerVM.Instance.clientBinaryHTTP.GetAllSeries(JMMServerVM.Instance.CurrentUser.JMMUserID.Value); foreach (JMMServerBinary.Contract_AnimeSeries ser in sersRaw) { AnimeSeriesVM serNew = new AnimeSeriesVM(ser); AllSeries.Add(serNew); } ViewGroups.Filter = GroupSeriesSearchFilter; ViewSeries.Filter = GroupSeriesSearchFilter; } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void SetNextEpisode(bool onlyRandom) { if (PlaylistObjects.Count == 0) return; // find the next episode to play NextEpisode = null; if (DefaultPlayOrderEnum == PlaylistPlayOrder.Sequential && !onlyRandom) { bool foundEp = false; while (!foundEp) { foreach (PlaylistItemVM pli in PlaylistObjects) { if (pli.ItemType == JMMClient.PlaylistItemType.Episode) { AnimeEpisodeVM epTemp = pli.PlaylistItem as AnimeEpisodeVM; if (CanUseEpisode(this, epTemp)) { NextEpisode = epTemp; foundEp = true; break; } } if (pli.ItemType == JMMClient.PlaylistItemType.AnimeSeries) { AnimeSeriesVM ser = pli.PlaylistItem as AnimeSeriesVM; ser.RefreshBase(); ser.RefreshEpisodes(); List<AnimeEpisodeVM> eps = ser.AllEpisodes; List<SortPropOrFieldAndDirection> sortCriteria = new List<SortPropOrFieldAndDirection>(); sortCriteria.Add(new SortPropOrFieldAndDirection("EpisodeType", false, JMMClient.SortType.eInteger)); sortCriteria.Add(new SortPropOrFieldAndDirection("EpisodeNumber", false, JMMClient.SortType.eInteger)); eps = Sorting.MultiSort<AnimeEpisodeVM>(eps, sortCriteria); foreach (AnimeEpisodeVM epTemp in eps) { if (epTemp.EpisodeTypeEnum == EpisodeType.Episode || epTemp.EpisodeTypeEnum == EpisodeType.Special) { if (CanUseEpisode(this, epTemp)) { NextEpisode = epTemp; foundEp = true; break; } } } if (foundEp) break; } } break; } } else // random { // get all the candidate episodes List<AnimeEpisodeVM> canidateEps = new List<AnimeEpisodeVM>(); foreach (PlaylistItemVM pli in PlaylistObjects) { if (pli.ItemType == JMMClient.PlaylistItemType.Episode) { AnimeEpisodeVM epTemp = pli.PlaylistItem as AnimeEpisodeVM; if (CanUseEpisode(this, epTemp)) canidateEps.Add(epTemp); } if (pli.ItemType == JMMClient.PlaylistItemType.AnimeSeries) { AnimeSeriesVM ser = pli.PlaylistItem as AnimeSeriesVM; ser.RefreshBase(); ser.RefreshEpisodes(); List<AnimeEpisodeVM> eps = ser.AllEpisodes; foreach (AnimeEpisodeVM epTemp in eps) { if (epTemp.EpisodeTypeEnum == EpisodeType.Episode || epTemp.EpisodeTypeEnum == EpisodeType.Special) { if (CanUseEpisode(this, epTemp)) canidateEps.Add(epTemp); } } } } // pick a random object from the play list if (canidateEps.Count > 0) { NextEpisode = canidateEps[epRandom.Next(0, canidateEps.Count)]; } } if (NextEpisode != null) { NextEpisode.SetTvDBInfo(); NextEpisode.RefreshAnime(); AniDB_Anime = NextEpisode.AniDB_Anime; if (MainListHelperVM.Instance.AllSeriesDictionary.ContainsKey(NextEpisode.AnimeSeriesID)) Series = MainListHelperVM.Instance.AllSeriesDictionary[NextEpisode.AnimeSeriesID]; } }
public void RefreshSeriesMissingEps() { try { System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { SeriesMissingEps.Clear(); }); List<JMMServerBinary.Contract_AnimeSeries> epSeries = JMMServerVM.Instance.clientBinaryHTTP.GetSeriesWithMissingEpisodes(UserSettingsVM.Instance.Dash_MissingEps_Items, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { foreach (JMMServerBinary.Contract_AnimeSeries contract in epSeries) { AnimeSeriesVM ser = new AnimeSeriesVM(contract); if (JMMServerVM.Instance.CurrentUser.EvaluateSeries(ser)) SeriesMissingEps.Add(ser); } ViewSeriesMissingEps.Refresh(); }); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { } }
void btnConfirm_Click(object sender, RoutedEventArgs e) { //AnimeGroupVM grp = null; int animeID = 0; int? groupID = null; try { if (IsAnimeNotSelected) { MessageBox.Show("Please select an anime first", "Error", MessageBoxButton.OK, MessageBoxImage.Error); txtAnimeSearch.Focus(); return; } if (IsExistingGroup) { if (lbGroups.SelectedItem == null) { MessageBox.Show(Properties.Resources.MSG_ERR_GroupSelectionRequired, "Error", MessageBoxButton.OK, MessageBoxImage.Error); lbGroups.Focus(); return; } else { AnimeGroupVM grp = lbGroups.SelectedItem as AnimeGroupVM; groupID = grp.AnimeGroupID.Value; } } if (IsNewGroup) { if (txtGroupName.Text.Trim().Length == 0) { MessageBox.Show(Properties.Resources.MSG_ERR_GroupNameRequired, "Error", MessageBoxButton.OK, MessageBoxImage.Error); txtGroupName.Focus(); return; } } if (SelectedAnime != null) animeID = SelectedAnime.AnimeID; this.Cursor = Cursors.Wait; if (IsNewGroup) { AnimeGroupVM grp = new AnimeGroupVM(); grp.GroupName = txtGroupName.Text.Trim(); grp.SortName = txtGroupName.Text.Trim(); grp.AnimeGroupParentID = null; grp.Description = ""; grp.IsFave = 0; grp.IsManuallyNamed = 0; grp.OverrideDescription = 0; if (grp.Validate()) { grp.IsReadOnly = true; grp.IsBeingEdited = false; if (grp.Save()) { MainListHelperVM.Instance.AllGroups.Add(grp); MainListHelperVM.Instance.AllGroupsDictionary[grp.AnimeGroupID.Value] = grp; MainListHelperVM.Instance.ViewGroups.Refresh(); groupID = grp.AnimeGroupID; } } } JMMServerBinary.Contract_AnimeSeries_SaveResponse response = JMMServerVM.Instance.clientBinaryHTTP.CreateSeriesFromAnime(animeID, groupID, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); if (response.ErrorMessage.Length > 0) { this.Cursor = Cursors.Arrow; MessageBox.Show(response.ErrorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } AnimeSeries = new AnimeSeriesVM(response.AnimeSeries); MainListHelperVM.Instance.AllSeries.Add(AnimeSeries); MainListHelperVM.Instance.AllSeriesDictionary[AnimeSeries.AnimeSeriesID.Value] = AnimeSeries; } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { this.Cursor = Cursors.Arrow; } this.DialogResult = true; this.Close(); }
private void RefreshRecords() { try { IsDataLoading = true; IsDataFinishedLoading = false; AnimeFolderSummaryRecords.Clear(); TotalFileCount = 0; double fileSize = 0; AniDB_AnimeVM anime = this.DataContext as AniDB_AnimeVM; if (anime == null) return; JMMServerBinary.Contract_AnimeSeries contract = JMMServerVM.Instance.clientBinaryHTTP.GetSeriesForAnime(anime.AnimeID, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); if (contract == null) return; thisSeries = new AnimeSeriesVM(contract); Dictionary<string, AnimeFolderSummary> folders = new Dictionary<string, AnimeFolderSummary>(); foreach (VideoLocalVM vid in anime.AllVideoLocals) { TotalFileCount++; fileSize += (double)vid.FileSize; foreach (VideoLocal_PlaceVM vplace in vid.Places) { if (!folders.ContainsKey(vplace.FileDirectory)) { AnimeFolderSummary fs = new AnimeFolderSummary(); fs.FolderName = vplace.FileDirectory; fs.FileCount = 0; fs.TotalFileSize = 0; folders[vplace.FileDirectory] = fs; } folders[vplace.FileDirectory].FileCount = folders[vplace.FileDirectory].FileCount + 1; folders[vplace.FileDirectory].TotalFileSize = folders[vplace.FileDirectory].TotalFileSize + vid.FileSize; } } bool foundDefault = false; foreach (AnimeFolderSummary afs in folders.Values) { afs.IsDefaultFolder = false; if (!string.IsNullOrEmpty(thisSeries.DefaultFolder)) { if (thisSeries.DefaultFolder.Equals(afs.FolderName, StringComparison.InvariantCultureIgnoreCase)) { afs.IsDefaultFolder = true; foundDefault = true; } } AnimeFolderSummaryRecords.Add(afs); } /*if (!foundDefault) { if (!string.IsNullOrEmpty(thisSeries.DefaultFolder)) { AnimeFolderSummary afs = new AnimeFolderSummary(); afs.FolderName = thisSeries.DefaultFolder; afs.FileCount = 0; afs.TotalFileSize = 0; afs.IsDefaultFolder = true; AnimeFolderSummaryRecords.Add(afs); } }*/ TotalFileSize = Utils.FormatFileSize(fileSize); IsDataLoading = false; IsDataFinishedLoading = true; } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void Init(AnimeSeriesVM series) { AllGroups = new ObservableCollection<AnimeGroupVM>(); ViewGroups = CollectionViewSource.GetDefaultView(AllGroups); ViewGroups.SortDescriptions.Add(new SortDescription("SortName", ListSortDirection.Ascending)); List<JMMServerBinary.Contract_AnimeGroup> grpsRaw = JMMServerVM.Instance.clientBinaryHTTP.GetAllGroups(JMMServerVM.Instance.CurrentUser.JMMUserID.Value); foreach (JMMServerBinary.Contract_AnimeGroup grp in grpsRaw) { AnimeGroupVM grpNew = new AnimeGroupVM(grp); AllGroups.Add(grpNew); } ViewGroups.Filter = GroupSearchFilter; Series = series; txtGroupName.Text = Series.SeriesName; txtGroupSortName.Text = Series.SeriesName; }
public bool EvaluateSeries(AnimeSeriesVM ser) { // make sure the user has not filtered this out if (!string.IsNullOrEmpty(JMMServerVM.Instance.CurrentUser.HideCategories)) { return EvaluateCategoryString(ser.CategoriesString); } return true; }
public void SetDependendProperties() { AniDB_Anime = null; Series = null; SetNextEpisode(); }
public void ShowChildrenForCurrentGroup(AnimeSeriesVM ser) { if (lbGroupsSeries.SelectedItem == null) return; if (lbGroupsSeries.SelectedItem is MainListWrapper) { // this is the last supported drill down if (lbGroupsSeries.SelectedItem.GetType() == typeof(AnimeSeriesVM)) return; //MainListHelperVM.Instance.LastAnimeSeriesID = ser.AnimeSeriesID.Value; EnableDisableGroupControls(false); showChildWrappersWorker.RunWorkerAsync(lbGroupsSeries.SelectedItem); } }
public void InitGroupsSeriesData() { //LoadTestData(); //return; try { // set this to null so that it will be refreshed the next time it is needed AllAnimeDetailedDictionary = null; List<JMMServerBinary.Contract_AnimeGroup> grpsRaw = JMMServerVM.Instance.clientBinaryHTTP.GetAllGroups(JMMServerVM.Instance.CurrentUser.JMMUserID.Value); List<JMMServerBinary.Contract_AnimeSeries> seriesRaw = JMMServerVM.Instance.clientBinaryHTTP.GetAllSeries(JMMServerVM.Instance.CurrentUser.JMMUserID.Value); if (grpsRaw.Count == 0 || seriesRaw.Count == 0) return; AllGroups.Clear(); AllSeries.Clear(); AllGroupsDictionary.Clear(); AllSeriesDictionary.Clear(); AllAnimeDictionary.Clear(); // must series before groups the binding is based on the groups, and will refresh when that is changed foreach (JMMServerBinary.Contract_AnimeSeries ser in seriesRaw) { AnimeSeriesVM serNew = new AnimeSeriesVM(ser); AllSeries.Add(serNew); AllSeriesDictionary[serNew.AnimeSeriesID.Value] = serNew; } foreach (JMMServerBinary.Contract_AnimeGroup grp in grpsRaw) { AnimeGroupVM grpNew = new AnimeGroupVM(grp); AllGroups.Add(grpNew); AllGroupsDictionary[grpNew.AnimeGroupID.Value] = grpNew; } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void ShowPinnedSeriesOld(AnimeSeriesVM series) { this.Cursor = Cursors.Wait; CloseableTabItem cti = new CloseableTabItem(); //TabItem cti = new TabItem(); // if the pinned tab already has this, don't open it again. int curTab = -1; foreach (object obj in tabPinned.Items) { curTab++; CloseableTabItem ctiTemp = obj as CloseableTabItem; if (ctiTemp == null) continue; AnimeSeries ctrl = ctiTemp.Content as AnimeSeries; if (ctrl == null) continue; AnimeSeriesVM ser = ctrl.DataContext as AnimeSeriesVM; if (ser == null) continue; if (ser.AnimeSeriesID == series.AnimeSeriesID) { tabControl1.SelectedIndex = TAB_MAIN_Pinned; tabPinned.SelectedIndex = curTab; this.Cursor = Cursors.Arrow; return; } } string tabHeader = series.SeriesName; if (tabHeader.Length > 30) tabHeader = tabHeader.Substring(0, 30) + "..."; cti.Header = tabHeader; //AnimeSeries_Hulu seriesControl = new AnimeSeries_Hulu(); AnimeSeries seriesControl = new AnimeSeries(); seriesControl.DataContext = series; cti.Content = seriesControl; tabPinned.Items.Add(cti); tabControl1.SelectedIndex = TAB_MAIN_Pinned; tabPinned.SelectedIndex = tabPinned.Items.Count - 1; this.Cursor = Cursors.Arrow; }
public void PopulatePlaylistObjects() { PlaylistObjects.Clear(); if (string.IsNullOrEmpty(this.PlaylistItems)) return; string[] items = this.PlaylistItems.Split('|'); foreach (string pitem in items) { string[] parms = pitem.Split(';'); if (parms.Length != 2) continue; int objType = -1; int objID = -1; if (!int.TryParse(parms[0], out objType)) continue; if (!int.TryParse(parms[1], out objID)) continue; if ((PlaylistItemType)objType == PlaylistItemType.AnimeSeries) { AnimeSeriesVM ser; if (MainListHelperVM.Instance.AllSeriesDictionary.TryGetValue(objID, out ser) == false) { // get the series JMMServerBinary.Contract_AnimeSeries serContract = JMMServerVM.Instance.clientBinaryHTTP.GetSeries(objID, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); if (serContract != null) { ser = new AnimeSeriesVM(serContract); MainListHelperVM.Instance.AllSeriesDictionary[objID] = ser; } } if (ser != null) PlaylistObjects.Add(new PlaylistItemVM(this.PlaylistID.Value, PlaylistItemType.AnimeSeries, ser)); } else { // get the episode JMMServerBinary.Contract_AnimeEpisode epContract = JMMServerVM.Instance.clientBinaryHTTP.GetEpisode(objID, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); if (epContract != null) { AnimeEpisodeVM ep = new AnimeEpisodeVM(epContract); //ep.SetTvDBInfo(); PlaylistObjects.Add(new PlaylistItemVM(this.PlaylistID.Value, PlaylistItemType.Episode, ep)); } } } SetDependendProperties(); }
public void RefreshRecentAdditions(RecentAdditionsType addType) { try { System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { RecentAdditions.Clear(); }); if (addType == RecentAdditionsType.Episode) { List<JMMServerBinary.Contract_AnimeEpisode> epContracts = JMMServerVM.Instance.clientBinaryHTTP.GetEpisodesRecentlyAdded(UserSettingsVM.Instance.Dash_RecentAdditions_Items, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { foreach (JMMServerBinary.Contract_AnimeEpisode contract in epContracts) { AnimeEpisodeVM ep = new AnimeEpisodeVM(contract); ep.RefreshAnime(); if (ep.AniDB_Anime == null) ep.RefreshAnime(true); // this might be a new series if (ep.AniDB_Anime != null) { ep.SetTvDBInfo(); RecentAdditions.Add(ep); } } ViewRecentAdditions.Refresh(); }); } else { List<JMMServerBinary.Contract_AnimeSeries> serContracts = JMMServerVM.Instance.clientBinaryHTTP.GetSeriesRecentlyAdded(UserSettingsVM.Instance.Dash_RecentAdditions_Items, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { foreach (JMMServerBinary.Contract_AnimeSeries contract in serContracts) { AnimeSeriesVM ser = new AnimeSeriesVM(contract); RecentAdditions.Add(ser); } ViewRecentAdditions.Refresh(); }); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { } }
private void SetAttachedSeries(AnimeSeriesVM ser) { try { HasAttachedSeries = ser != null; if (ser == null) { this.DataContext = null; this.ucFileSummary.DataContext = null; return; } this.DataContext = ser; this.ucFileSummary.DataContext = ser.AniDB_Anime; } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void UpdateHeirarchy(AnimeSeriesVM ser) { try { // update the attached series // refresh the data ser.RefreshBase(); ser.AniDB_Anime.Detail.RefreshBase(); List<JMMServerBinary.Contract_AnimeGroup> grps = JMMServerVM.Instance.clientBinaryHTTP.GetAllGroupsAboveSeries(ser.AnimeSeriesID.Value, JMMServerVM.Instance.CurrentUser.JMMUserID.Value); foreach (AnimeGroupVM grp in MainListHelperVM.Instance.AllGroups) { foreach (JMMServerBinary.Contract_AnimeGroup grpContract in grps) { if (grp.AnimeGroupID.Value == grpContract.AnimeGroupID) { grp.Populate(grpContract); break; } } } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void ShowPinnedSeries(AnimeSeriesVM series) { this.Cursor = Cursors.Wait; CloseableTabItem cti = new CloseableTabItem(); //TabItem cti = new TabItem(); cti.Header = series.SeriesName; //AnimeSeries_Hulu seriesControl = new AnimeSeries_Hulu(); AnimeSeries seriesControl = new AnimeSeries(); seriesControl.DataContext = series; cti.Content = seriesControl; tabPinned.Items.Add(cti); tabControl1.SelectedIndex = TAB_MAIN_Pinned; tabPinned.SelectedIndex = tabPinned.Items.Count - 1; this.Cursor = Cursors.Arrow; }
public void Init(AnimeSeriesVM series) { Series = series; this.DataContext = Series; ucTraktComments.DataContext = Series; }
public bool EvaluateSeries(AnimeSeriesVM ser) { // make sure the user has not filtered this out return EvaluateTags(ser.AllTags); }