Ejemplo n.º 1
0
        private void ShowNextEpisode()
        {
            AnimeGroupVM grp = this.DataContext as AnimeGroupVM;

            if (grp == null)
            {
                return;
            }

            if (!grp.AnimeGroupID.HasValue)
            {
                ucNextEpisode.EpisodeExists  = false;
                ucNextEpisode.EpisodeMissing = true;
                ucNextEpisode.DataContext    = null;
                return;
            }

            JMMServerBinary.Contract_AnimeEpisode ep = JMMServerVM.Instance.clientBinaryHTTP.GetNextUnwatchedEpisodeForGroup(grp.AnimeGroupID.Value,
                                                                                                                             JMMServerVM.Instance.CurrentUser.JMMUserID.Value);
            if (ep != null)
            {
                AnimeEpisodeVM aniep = new AnimeEpisodeVM(ep);
                aniep.SetTvDBInfo();
                ucNextEpisode.DataContext = aniep;
            }
            else
            {
                ucNextEpisode.EpisodeExists  = false;
                ucNextEpisode.EpisodeMissing = true;
                ucNextEpisode.DataContext    = null;
            }
        }
Ejemplo n.º 2
0
		public static bool EvaluateGroupTextSearch(AnimeGroupVM grp, string filterText)
		{
			if (String.IsNullOrEmpty(filterText) || grp == null)
				return true;

			// do this so that when viewing sub groups they don't get filtered
			if (grp.AnimeGroupParentID.HasValue) return true;

			// get all possible names for the group

			// search the group name
			int index = grp.GroupName.IndexOf(filterText, 0, StringComparison.InvariantCultureIgnoreCase);
			if (index > -1) return true;

			// search the sort name
			index = grp.SortName.IndexOf(filterText, 0, StringComparison.InvariantCultureIgnoreCase);
			if (index > -1) return true;

			// check the categories
			if (grp.Stat_AllCategories != null)
			{
				index = grp.Stat_AllCategories.IndexOf(filterText, 0, StringComparison.InvariantCultureIgnoreCase);
				if (index > -1) return true;
			}

			// search the titles (romaji name, english names) etc from anidb
			if (grp.Stat_AllTitles != null)
			{
				index = grp.Stat_AllTitles.IndexOf(filterText, 0, StringComparison.InvariantCultureIgnoreCase);
				if (index > -1) return true;
			}

			return false;
		}
Ejemplo n.º 3
0
        public bool EvaluateGroup(AnimeGroupVM grp)
        {
            if (grp.AnimeGroupID.Value == 215)
            {
                Console.WriteLine("");
            }

            return(EvaluateTags(grp.Stat_AllTags));
        }
Ejemplo n.º 4
0
        void btnOK_Click(object sender, RoutedEventArgs e)
        {
            int?groupID = null;

            if (IsExistingGroup)
            {
                if (lbGroups.SelectedItem == null)
                {
                    MessageBox.Show(Properties.Resources.MSG_ERR_GroupSelectionRequired, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    lbGroups.Focus();
                    return;
                }
                else
                {
                    SelectedGroup     = lbGroups.SelectedItem as AnimeGroupVM;
                    this.DialogResult = true;
                    this.Close();
                }
            }

            if (IsNewGroup)
            {
                if (txtGroupName.Text.Trim().Length == 0)
                {
                    MessageBox.Show(Properties.Resources.MSG_ERR_GroupNameRequired, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtGroupName.Focus();
                    return;
                }

                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;
                    }
                }
                SelectedGroup     = grp;
                this.DialogResult = true;
                this.Close();
            }
        }
Ejemplo n.º 5
0
        public bool EvaluateGroup(AnimeGroupVM grp)
        {
            // make sure the user has not filtered this out
            if (!string.IsNullOrEmpty(JMMServerVM.Instance.CurrentUser.HideCategories))
            {
                return(EvaluateCategoryString(grp.Stat_AllCategories));
            }

            return(true);
        }
Ejemplo n.º 6
0
        private bool GroupSearchFilter(object obj)
        {
            AnimeGroupVM grpvm = obj as AnimeGroupVM;

            if (grpvm == null)
            {
                return(true);
            }

            return(GroupSearchFilterHelper.EvaluateGroupTextSearch(grpvm, txtGroupSearch.Text));
        }
Ejemplo n.º 7
0
        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;
            }
        }
Ejemplo n.º 8
0
        public bool EvaluateGroup(AnimeGroupVM grp)
        {
            if (grp.AnimeGroupID.Value == 215)
            {
                Console.WriteLine("");
            }

            // make sure the user has not filtered this out
            if (!string.IsNullOrEmpty(JMMServerVM.Instance.CurrentUser.HideTags))
            {
                return(EvaluateTagString(grp.Stat_AllTags));
            }

            return(true);
        }
        private void PopulateAnimeGroups()
        {
            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;
        }
Ejemplo n.º 10
0
        void btnRandomEpisode_Click(object sender, RoutedEventArgs e)
        {
            AnimeGroupVM grp = this.DataContext as AnimeGroupVM;

            if (grp == null)
            {
                return;
            }

            MainWindow mainwdw = (MainWindow)Window.GetWindow(this);

            RandomEpisodeForm frm = new RandomEpisodeForm();

            frm.Owner = Window.GetWindow(this);;
            frm.Init(RandomSeriesEpisodeLevel.Group, grp);
            bool?result = frm.ShowDialog();
        }
Ejemplo n.º 11
0
        void btnRemoveDefaultSeries_Click(object sender, RoutedEventArgs e)
        {
            AnimeGroupVM grp = this.DataContext as AnimeGroupVM;

            if (grp == null)
            {
                return;
            }

            if (!grp.AnimeGroupID.HasValue)
            {
                return;
            }

            JMMServerVM.Instance.clientBinaryHTTP.RemoveDefaultSeriesForGroup(grp.AnimeGroupID.Value);
            grp.DefaultAnimeSeriesID = null;
        }
Ejemplo n.º 12
0
        private bool GroupSeriesSearchFilter(object obj)
        {
            AnimeGroupVM grpvm = obj as AnimeGroupVM;

            if (grpvm != null)
            {
                return(GroupSearchFilterHelper.EvaluateGroupTextSearch(grpvm, txtGroupSearch.Text));
            }

            AnimeSeriesVM ser = obj as AnimeSeriesVM;

            if (ser != null)
            {
                return(GroupSearchFilterHelper.EvaluateSeriesTextSearch(ser, txtGroupSearch.Text));
            }

            return(false);
        }
Ejemplo n.º 13
0
        public void Init(AniDB_AnimeVM anime, string defaultGroupName)
        {
            AnimeSearchVM srch = new AnimeSearchVM();

            srch.AnimeID   = anime.AnimeID;
            srch.MainTitle = anime.MainTitle;
            srch.Titles    = new HashSet <string>(anime.AllTitles, StringComparer.InvariantCultureIgnoreCase);

            SetSelectedAnime(srch);
            EvaluateRadioButtons();

            rbGroupExisting.IsChecked = true;

            AllGroups     = new ObservableCollection <AnimeGroupVM>();
            SearchResults = new ObservableCollection <AnimeSearchVM>();

            try
            {
                ViewGroups = CollectionViewSource.GetDefaultView(AllGroups);
                ViewGroups.SortDescriptions.Add(new SortDescription("SortName", ListSortDirection.Ascending));

                ViewSearchResults = CollectionViewSource.GetDefaultView(SearchResults);
                ViewSearchResults.SortDescriptions.Add(new SortDescription("MainTitle", 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;

                txtGroupName.Text     = defaultGroupName;
                txtGroupSortName.Text = defaultGroupName;
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
Ejemplo n.º 14
0
        public static string GetPosterAsFileName(AnimeGroupVM grp)
        {
            List <string> allPosters = new List <string>();
            string        fileName   = "";

            if (grp.DefaultAnimeSeriesID.HasValue)
            {
                AnimeSeriesVM ser = grp.DefaultSeries;
                if (ser != null)
                {
                    AniDB_AnimeVM anime = ser.AniDB_Anime;
                    fileName = GetPosterAsFileName(anime);
                    if (!string.IsNullOrEmpty(fileName) && File.Exists(fileName))
                    {
                        allPosters.Add(fileName);
                    }
                }
            }
            else
            {
                // get all the series for this group
                foreach (AnimeSeriesVM ser in grp.AllSeries)
                {
                    AniDB_AnimeVM anime = ser.AniDB_Anime;

                    fileName = GetPosterAsFileName(anime);
                    if (!string.IsNullOrEmpty(fileName) && File.Exists(fileName))
                    {
                        allPosters.Add(fileName);
                    }
                }
            }

            if (allPosters.Count > 0)
            {
                fileName = allPosters[bannerRandom.Next(0, allPosters.Count - 1)];
            }

            return(fileName);
        }
Ejemplo n.º 15
0
        public static String GetGroupImage(AnimeGroupVM grp, GUIFacadeControl.Layout viewMode)
        {
            string imgFileName = "";
            Size   sz          = PosterSize;

            switch (viewMode)
            {
            case GUIFacadeControl.Layout.LargeIcons:
                imgFileName = GetWideBannerAsFileName(grp); sz = BannerSize; break;

            case GUIFacadeControl.Layout.List:
            case GUIFacadeControl.Layout.AlbumView:
            case GUIFacadeControl.Layout.Filmstrip:
            case GUIFacadeControl.Layout.CoverFlow:
                imgFileName = GetPosterAsFileName(grp); sz = PosterSize; break;
            }

            //BaseConfig.MyAnimeLog.Write("GetGroupBanner::viewMode: {0} : {1} : {2}", viewMode, imgFileName, grp);

            if (string.IsNullOrEmpty(imgFileName))
            {
                string ident        = "series_" + grp.GroupName;
                string sTextureName = buildMemoryImage(drawSimpleBanner(sz, grp.GroupName), ident, sz, true);

                if (sTextureName.Length > 0 && !s_SeriesImageList.Contains(sTextureName))
                {
                    s_SeriesImageList.Add(sTextureName);
                }
                return(sTextureName);
            }
            else
            {
                string sTextureName = "";
                if (imgFileName.Length > 0 && System.IO.File.Exists(imgFileName))
                {
                    sTextureName = buildMemoryImageFromFile(imgFileName, sz);
                }
                return(sTextureName);
            }
        }
Ejemplo n.º 16
0
        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);
            }
        }
Ejemplo n.º 17
0
        void btnSelectDefaultSeries_Click(object sender, RoutedEventArgs e)
        {
            AnimeGroupVM grp = this.DataContext as AnimeGroupVM;

            if (grp == null)
            {
                return;
            }

            Window wdw = Window.GetWindow(this);

            SelectDefaultSeriesForm frm = new SelectDefaultSeriesForm();

            frm.Owner = wdw;
            frm.Init(grp);
            bool?result = frm.ShowDialog();

            if (result.Value)
            {
                // update info
                grp.DefaultAnimeSeriesID = frm.SelectedSeriesID.Value;
                JMMServerVM.Instance.clientBinaryHTTP.SetDefaultSeriesForGroup(grp.AnimeGroupID.Value, frm.SelectedSeriesID.Value);
            }
        }
Ejemplo n.º 18
0
        public static String GetGroupImageAsFileName(AnimeGroupVM grp, GUIFacadeControl.Layout viewMode)
        {
            string imgFileName = "";

            DateTime start = DateTime.Now;

            switch (viewMode)
            {
            case GUIFacadeControl.Layout.LargeIcons:
                imgFileName = GetWideBannerAsFileName(grp); break;

            case GUIFacadeControl.Layout.List:
            case GUIFacadeControl.Layout.AlbumView:
            case GUIFacadeControl.Layout.Filmstrip:
            case GUIFacadeControl.Layout.CoverFlow:
                imgFileName = GetPosterAsFileName(grp); break;
            }

            TimeSpan ts = DateTime.Now - start;

            BaseConfig.MyAnimeLog.Write("GetGroupImageAsFileName::: {0} in {1}ms", grp.GroupName, ts.TotalMilliseconds);

            return(imgFileName);
        }
Ejemplo n.º 19
0
        private List <AnimeSeriesVM> GetSeriesForGroup()
        {
            List <AnimeSeriesVM> serList = new List <AnimeSeriesVM>();

            try
            {
                BaseConfig.MyAnimeLog.Write("Getting list of candidate random series for group");

                if (MainWindow.RandomWindow_RandomLevel != RandomSeriesEpisodeLevel.Group)
                {
                    return(serList);
                }
                AnimeGroupVM grp = MainWindow.RandomWindow_LevelObject as AnimeGroupVM;
                if (grp == null)
                {
                    return(serList);
                }

                bool allCats = MainWindow.RandomWindow_SeriesAllCategories;
                if (MainWindow.RandomWindow_RandomType == RandomObjectType.Episode)
                {
                    allCats = MainWindow.RandomWindow_EpisodeAllCategories;
                }

                BaseConfig.MyAnimeLog.Write("Getting list of candidate random series for: " + grp.GroupName);

                string selectedCategories = MainWindow.RandomWindow_SeriesCategories;
                if (MainWindow.RandomWindow_RandomType == RandomObjectType.Episode)
                {
                    selectedCategories = MainWindow.RandomWindow_EpisodeCategories;
                }

                foreach (AnimeSeriesVM ser in grp.AllSeries)
                {
                    // categories
                    if (!string.IsNullOrEmpty(selectedCategories))
                    {
                        string filterParm = selectedCategories.Trim();

                        string[] cats = filterParm.Split(',');

                        bool foundCat = false;
                        if (allCats)
                        {
                            foundCat = true;                                  // all
                        }
                        int index = 0;
                        foreach (string cat in cats)
                        {
                            string thiscat = cat.Trim();
                            if (thiscat.Trim().Length == 0)
                            {
                                continue;
                            }
                            if (thiscat.Trim() == ",")
                            {
                                continue;
                            }

                            index = ser.CategoriesString.IndexOf(thiscat, 0, StringComparison.InvariantCultureIgnoreCase);

                            if (!allCats)                             // any
                            {
                                if (index > -1)
                                {
                                    foundCat = true;
                                    break;
                                }
                            }
                            else                             //all
                            {
                                if (index < 0)
                                {
                                    foundCat = false;
                                    break;
                                }
                            }
                        }
                        if (!foundCat)
                        {
                            continue;
                        }
                    }
                    serList.Add(ser);
                }
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write(ex.ToString());
            }

            return(serList);
        }
Ejemplo n.º 20
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if (MA3WindowManager.HandleWindowChangeButton(control))
            {
                return;
            }

            if (btnAddCategory != null && control == btnAddCategory)
            {
                string cat = Utils.PromptSelectCategory("");
                if (!string.IsNullOrEmpty(cat))
                {
                    if (!string.IsNullOrEmpty(MainWindow.RandomWindow_SeriesCategories))
                    {
                        MainWindow.RandomWindow_SeriesCategories += ", ";
                    }

                    MainWindow.RandomWindow_SeriesCategories += cat;

                    SetDisplayDetails();
                }
            }

            if (btnEpisodeAddCategory != null && control == btnEpisodeAddCategory)
            {
                string cat = Utils.PromptSelectCategory("");
                if (!string.IsNullOrEmpty(cat))
                {
                    if (!string.IsNullOrEmpty(MainWindow.RandomWindow_EpisodeCategories))
                    {
                        MainWindow.RandomWindow_EpisodeCategories += ", ";
                    }

                    MainWindow.RandomWindow_EpisodeCategories += cat;

                    SetDisplayDetails();
                }
            }

            if (btnClearcategories != null && control == btnClearcategories)
            {
                MainWindow.RandomWindow_SeriesCategories = "";
                SetDisplayDetails();
            }

            if (btnEpisodeClearcategories != null && control == btnEpisodeClearcategories)
            {
                MainWindow.RandomWindow_EpisodeCategories = "";
                SetDisplayDetails();
            }

            if (btnAllAnycategories != null && control == btnAllAnycategories)
            {
                MainWindow.RandomWindow_SeriesAllCategories = !MainWindow.RandomWindow_SeriesAllCategories;
                SetDisplayDetails();
            }

            if (btnEpisodeAllAnycategories != null && control == btnEpisodeAllAnycategories)
            {
                MainWindow.RandomWindow_EpisodeAllCategories = !MainWindow.RandomWindow_EpisodeAllCategories;
                SetDisplayDetails();
            }

            if (btnRandom != null && control == btnRandom)
            {
                if (togWatched != null)
                {
                    MainWindow.RandomWindow_SeriesWatched = togWatched.Selected;
                }
                if (togUnwatched != null)
                {
                    MainWindow.RandomWindow_SeriesUnwatched = togUnwatched.Selected;
                }
                if (togPartiallyWatched != null)
                {
                    MainWindow.RandomWindow_SeriesPartiallyWatched = togPartiallyWatched.Selected;
                }
                if (togCompleteOnly != null)
                {
                    MainWindow.RandomWindow_SeriesOnlyComplete = togCompleteOnly.Selected;
                }

                if (togEpisodeUnwatched != null)
                {
                    MainWindow.RandomWindow_EpisodeUnwatched = togEpisodeUnwatched.Selected;
                }
                if (togEpisodeWatched != null)
                {
                    MainWindow.RandomWindow_EpisodeWatched = togEpisodeWatched.Selected;
                }

                MainWindow.RandomWindow_CurrentEpisode = null;
                MainWindow.RandomWindow_CurrentSeries  = null;
                this.btnRandom.IsFocused = true;
                LoadData();
            }

            if (btnSwitchSeries != null && control == btnSwitchSeries)
            {
                this.btnSwitchSeries.IsFocused     = false;
                this.btnRandom.IsFocused           = true;
                MainWindow.RandomWindow_RandomType = RandomObjectType.Series;
                LoadData();
            }

            if (btnSwitchEpisode != null && control == btnSwitchEpisode)
            {
                this.btnSwitchEpisode.IsFocused    = false;
                this.btnRandom.IsFocused           = true;
                MainWindow.RandomWindow_RandomType = RandomObjectType.Episode;
                LoadData();
            }

            if (btnPlayEpisode != null && control == btnPlayEpisode)
            {
                if (MainWindow.RandomWindow_CurrentEpisode == null)
                {
                    return;
                }
                MainWindow.vidHandler.ResumeOrPlay(MainWindow.RandomWindow_CurrentEpisode);
            }


            if (btnEpisodeList != null && control == btnEpisodeList)
            {
                if (MainWindow.RandomWindow_CurrentSeries == null)
                {
                    return;
                }
                MainWindow.curGroupFilter = GroupFilterHelper.AllGroupsFilter;

                // find the group for this series
                AnimeGroupVM grp = JMMServerHelper.GetGroup(MainWindow.RandomWindow_CurrentSeries.AnimeGroupID);
                if (grp == null)
                {
                    BaseConfig.MyAnimeLog.Write("Group not found");
                    return;
                }
                MainWindow.curAnimeGroup       = grp;
                MainWindow.curAnimeGroupViewed = grp;
                MainWindow.curAnimeSeries      = MainWindow.RandomWindow_CurrentSeries;

                bool foundEpType = false;
                foreach (AnimeEpisodeTypeVM anEpType in MainWindow.RandomWindow_CurrentSeries.EpisodeTypesToDisplay)
                {
                    if (anEpType.EpisodeType == enEpisodeType.Episode)
                    {
                        MainWindow.curAnimeEpisodeType = anEpType;
                        foundEpType = true;
                        break;
                    }
                }

                if (!foundEpType)
                {
                    return;
                }


                MainWindow.listLevel = Listlevel.Episode;

                GUIWindowManager.CloseCurrentWindow();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.MAIN, false);
                return;
            }

            base.OnClicked(controlId, control, actionType);
        }
Ejemplo n.º 21
0
        public bool EvaluateGroup(AnimeGroupVM grp)
        {
            if (grp.AnimeGroupID.Value == 215)
                Console.WriteLine("");

            // make sure the user has not filtered this out
            if (!string.IsNullOrEmpty(JMMServerVM.Instance.CurrentUser.HideTags))
            {
                return EvaluateTagString(grp.Stat_AllTags);
            }

            return true;
        }
Ejemplo n.º 22
0
 public static void DeleteGroup(AnimeGroupVM grp)
 {
 }
Ejemplo n.º 23
0
        private void Group_OnItemSelected(GUIListItem item)
        {
            if (item == null || item.TVTag == null || !(item.TVTag is AnimeGroupVM))
                return;

            AnimeGroupVM grp = item.TVTag as AnimeGroupVM;
            if (grp == null) return;

            curAnimeGroup = grp;

            if (displayGrpTimer != null)
                displayGrpTimer.Stop();

            displayGrpTimer = new System.Timers.Timer();
            displayGrpTimer.AutoReset = false;
            displayGrpTimer.Interval = BaseConfig.Settings.InfoDelay; // 250ms
            displayGrpTimer.Elapsed += new System.Timers.ElapsedEventHandler(displayGrpTimer_Elapsed);
            displayGrpTimer.Enabled = true;
        }
Ejemplo n.º 24
0
        private void ShowChildrenLevelForGroup()
        {
            List<AnimeGroupVM> subGroups = curAnimeGroupViewed.SubGroups;
            List<AnimeSeriesVM> seriesList = curAnimeGroupViewed.ChildSeries;

            int subLevelCount = seriesList.Count + subGroups.Count;

            if (subLevelCount > 1)
            {
                listLevel = Listlevel.Series;
                LoadFacade();
                return;
            }
            else if (subLevelCount == 1)
            {
                // keep drilling down until we find a series
                // or more than one sub level
                while (subLevelCount == 1 && subGroups.Count > 0)
                {
                    curAnimeGroupViewed = subGroups[0];
                    curAnimeGroup = subGroups[0];

                    subGroups = curAnimeGroup.SubGroups;
                    seriesList = curAnimeGroup.ChildSeries;
                    subLevelCount = seriesList.Count + subGroups.Count;
                }

                if (subGroups.Count == 0)
                {
                    // means we got all the way down to a series
                    if (seriesList.Count > 1)
                    {
                        listLevel = Listlevel.Series;
                    }
                    else if (seriesList.Count == 1)
                    {
                        curAnimeSeries = seriesList[0];
                        ShowChildrenLevelForSeries();
                    }
                }
                else
                {
                    // else we have more than one sub level to display
                    listLevel = Listlevel.Series;
                }
            }
        }
Ejemplo n.º 25
0
 public void Init(AnimeGroupVM grp)
 {
     SeriesForGroup = grp.AllAnimeSeries;
 }
Ejemplo n.º 26
0
        private void SetDisplayDetails()
        {
            string combinedDetails = "";

            setGUIProperty("LevelType", "-");
            setGUIProperty("LevelName", "-");
            setGUIProperty("NumberOfMatches", "-");
            setGUIProperty("CombinedFilterDetails", "-");
            setGUIProperty("Series.CategoryType", "-");
            setGUIProperty("Episode.CategoryType", "-");
            setGUIProperty("Series.Categories", "-");
            setGUIProperty("Episode.Categories", "-");

            if (MainWindow.RandomWindow_RandomLevel == RandomSeriesEpisodeLevel.GroupFilter)
            {
                setGUIProperty("LevelType", "Group Filter");
                GroupFilterVM gf = MainWindow.RandomWindow_LevelObject as GroupFilterVM;
                setGUIProperty("LevelName", gf.GroupFilterName);

                combinedDetails += "Group Filter: " + gf.GroupFilterName;
            }
            if (MainWindow.RandomWindow_RandomLevel == RandomSeriesEpisodeLevel.Group)
            {
                setGUIProperty("LevelType", "Group");
                AnimeGroupVM grp = MainWindow.RandomWindow_LevelObject as AnimeGroupVM;
                setGUIProperty("LevelName", grp.GroupName);

                combinedDetails += "Group: " + grp.GroupName;
            }
            if (MainWindow.RandomWindow_RandomLevel == RandomSeriesEpisodeLevel.Series)
            {
                setGUIProperty("LevelType", "Series");
                AnimeSeriesVM ser = MainWindow.RandomWindow_LevelObject as AnimeSeriesVM;
                setGUIProperty("LevelName", ser.SeriesName);

                combinedDetails += "Series: " + ser.SeriesName;
            }

            if (MainWindow.RandomWindow_RandomType == RandomObjectType.Series)
            {
                combinedDetails += string.Format(" ({0} Matches)", MainWindow.RandomWindow_MatchesFound);
            }

            setGUIProperty("CombinedFilterDetails", combinedDetails);

            setGUIProperty("NumberOfMatches", MainWindow.RandomWindow_MatchesFound.ToString());

            setGUIProperty("Series.Categories", MainWindow.RandomWindow_SeriesCategories);
            setGUIProperty("Episode.Categories", MainWindow.RandomWindow_EpisodeCategories);

            if (MainWindow.RandomWindow_SeriesAllCategories)
            {
                setGUIProperty("Series.CategoryType", "All");
            }
            else
            {
                setGUIProperty("Series.CategoryType", "Any");
            }

            if (MainWindow.RandomWindow_EpisodeAllCategories)
            {
                setGUIProperty("Episode.CategoryType", "All");
            }
            else
            {
                setGUIProperty("Episode.CategoryType", "Any");
            }
        }
        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);
            }
        }
Ejemplo n.º 28
0
        public bool EvaluateGroup(AnimeGroupVM grp)
        {
            if (grp.AnimeGroupID.Value == 215)
                Console.WriteLine("");

            return EvaluateTags(grp.Stat_AllTags);
        }
Ejemplo n.º 29
0
		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);
			}


		}
Ejemplo n.º 30
0
		private void LoadTestData()
		{
			System.Windows.Application.Current.Dispatcher.Invoke( System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() 
			{ 
				AllGroups.Clear();
				AllSeries.Clear();

				AnimeGroupVM grpNew = new AnimeGroupVM();
				grpNew.GroupName = grpNew.SortName = "Bleach";
				AllGroups.Add(grpNew);

				grpNew = new AnimeGroupVM();
				grpNew.GroupName = grpNew.SortName = "Naruto";
				AllGroups.Add(grpNew);

				grpNew = new AnimeGroupVM();
				grpNew.GroupName = grpNew.SortName = "High School of the Dead";
				AllGroups.Add(grpNew);

				grpNew = new AnimeGroupVM();
				grpNew.GroupName = grpNew.SortName = "Gundam";
				AllGroups.Add(grpNew);
			});
		}
Ejemplo n.º 31
0
        protected override void OnShowContextMenu()
        {
            GUIListItem currentitem = this.m_Facade.SelectedListItem;

            if (currentitem == null)
            {
                return;
            }

            if (currentitem.TVTag.GetType() == typeof(AnimeEpisodeVM))
            {
                AnimeEpisodeVM ep = currentitem.TVTag as AnimeEpisodeVM;
                if (ep != null)
                {
                    GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                    if (dlg == null)
                    {
                        return;
                    }

                    dlg.Reset();
                    dlg.SetHeading(ep.EpisodeNumberAndName);
                    dlg.Add("Mark as Watched");
                    dlg.Add("Play Previous Episode");
                    dlg.Add("Go To Episode List");
                    dlg.Add("View Series Info");

                    dlg.DoModal(GUIWindowManager.ActiveWindow);

                    switch (dlg.SelectedLabel)
                    {
                    case 0:
                        ep.ToggleWatchedStatus(true);
                        LoadData();
                        break;

                    case 1:
                        if (ep.AnimeSeries == null)
                        {
                            return;
                        }
                        JMMServerBinary.Contract_AnimeEpisode contract = JMMServerVM.Instance.clientBinaryHTTP.GetPreviousEpisodeForUnwatched(ep.AnimeSeries.AnimeSeriesID.Value,
                                                                                                                                              JMMServerVM.Instance.CurrentUser.JMMUserID);

                        if (contract == null)
                        {
                            Utils.DialogMsg("Error", "Previous episode not found");
                            return;
                        }
                        AnimeEpisodeVM epPrev = new AnimeEpisodeVM(contract);
                        MainWindow.vidHandler.ResumeOrPlay(epPrev);
                        break;

                    case 2:

                        if (ep.AnimeSeries == null)
                        {
                            return;
                        }
                        MainWindow.curGroupFilter = GroupFilterHelper.AllGroupsFilter;

                        // find the group for this series
                        AnimeGroupVM grp = JMMServerHelper.GetGroup(ep.AnimeSeries.AnimeGroupID);
                        if (grp == null)
                        {
                            BaseConfig.MyAnimeLog.Write("Group not found");
                            return;
                        }
                        MainWindow.curAnimeGroup       = grp;
                        MainWindow.curAnimeGroupViewed = grp;
                        MainWindow.curAnimeSeries      = ep.AnimeSeries;

                        bool foundEpType = false;
                        foreach (AnimeEpisodeTypeVM anEpType in ep.AnimeSeries.EpisodeTypesToDisplay)
                        {
                            if (anEpType.EpisodeType == enEpisodeType.Episode)
                            {
                                MainWindow.curAnimeEpisodeType = anEpType;
                                foundEpType = true;
                                break;
                            }
                        }

                        if (!foundEpType)
                        {
                            return;
                        }

                        MainWindow.listLevel = Listlevel.Episode;
                        GUIWindowManager.ActivateWindow(Constants.WindowIDs.MAIN, false);

                        break;

                    case 3:

                        if (ep.AnimeSeries == null)
                        {
                            return;
                        }
                        MainWindow.GlobalSeriesID = ep.AnimeSeries.AnimeSeriesID.Value;
                        GUIWindowManager.ActivateWindow(Constants.WindowIDs.ANIMEINFO, false);

                        break;
                    }
                }
            }
        }
Ejemplo n.º 32
0
		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();
		}
Ejemplo n.º 33
0
        private List<AnimeSeriesVM> GetSeriesForGroupFilter()
        {
            List<AnimeSeriesVM> serList = new List<AnimeSeriesVM>();
            try
            {
                BaseConfig.MyAnimeLog.Write("Getting list of candidate random series");

                if (MainWindow.RandomWindow_RandomLevel != RandomSeriesEpisodeLevel.GroupFilter) return serList;
                GroupFilterVM gf = MainWindow.RandomWindow_LevelObject as GroupFilterVM;
                if (gf == null) return serList;

                BaseConfig.MyAnimeLog.Write("Getting list of candidate random series for: " + gf.GroupFilterName);

                bool allCats = MainWindow.RandomWindow_SeriesAllCategories;
                if (MainWindow.RandomWindow_RandomType == RandomObjectType.Episode)
                    allCats = MainWindow.RandomWindow_EpisodeAllCategories;

                bool completeSeries = true;
                bool allWatched = true;
                bool unwatched = true;
                bool partiallyWatched = true;

                if (togWatched != null) allWatched = togWatched.Selected;
                if (togUnwatched != null) unwatched = togUnwatched.Selected;
                if (togPartiallyWatched != null) partiallyWatched = togPartiallyWatched.Selected;
                if (togCompleteOnly != null) completeSeries = togCompleteOnly.Selected;

                List<JMMServerBinary.Contract_AnimeGroup> contracts = JMMServerVM.Instance.clientBinaryHTTP.GetAnimeGroupsForFilter(
                    gf.GroupFilterID.Value, JMMServerVM.Instance.CurrentUser.JMMUserID, BaseConfig.Settings.SingleSeriesGroups);

                BaseConfig.MyAnimeLog.Write("Total groups for filter = " + contracts.Count.ToString());

                string selectedCategories = MainWindow.RandomWindow_SeriesCategories;
                if (MainWindow.RandomWindow_RandomType == RandomObjectType.Episode)
                    selectedCategories = MainWindow.RandomWindow_EpisodeCategories;

                foreach (JMMServerBinary.Contract_AnimeGroup grpContract in contracts)
                {
                    AnimeGroupVM grp = new AnimeGroupVM(grpContract);
                    // ignore sub groups
                    if (grp.AnimeGroupParentID.HasValue) continue;

                    foreach (AnimeSeriesVM ser in grp.AllSeries)
                    {
                        // categories
                        if (!string.IsNullOrEmpty(selectedCategories))
                        {
                            string filterParm = selectedCategories.Trim();

                            string[] cats = filterParm.Split(',');

                            bool foundCat = false;
                            if (allCats) foundCat = true; // all

                            int index = 0;
                            foreach (string cat in cats)
                            {
                                string thiscat = cat.Trim();
                                if (thiscat.Trim().Length == 0) continue;
                                if (thiscat.Trim() == ",") continue;

                                index = ser.CategoriesString.IndexOf(thiscat, 0, StringComparison.InvariantCultureIgnoreCase);

                                if (!allCats) // any
                                {
                                    if (index > -1)
                                    {
                                        foundCat = true;
                                        break;
                                    }
                                }
                                else //all
                                {
                                    if (index < 0)
                                    {
                                        foundCat = false;
                                        break;
                                    }
                                }
                            }
                            if (!foundCat) continue;

                        }

                        if (!ser.IsComplete && completeSeries) continue;

                        if (allWatched && ser.AllFilesWatched)
                        {
                            serList.Add(ser);
                            continue;
                        }

                        if (unwatched && !ser.AnyFilesWatched)
                        {
                            serList.Add(ser);
                            continue;
                        }

                        if (partiallyWatched && ser.AnyFilesWatched && !ser.AllFilesWatched)
                        {
                            serList.Add(ser);
                            continue;
                        }
                    }

                }

            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write(ex.ToString());
            }

            return serList;
        }
Ejemplo n.º 34
0
		public void Init(int animeID, string defaultGroupName)
		{
			//SetSelectedAnime(animeID);

			SetSelectedAnime(null);
			EvaluateRadioButtons();

			rbGroupExisting.IsChecked = true;

			AllGroups = new ObservableCollection<AnimeGroupVM>();
			SearchResults = new ObservableCollection<AnimeSearchVM>();

			try
			{

				ViewGroups = CollectionViewSource.GetDefaultView(AllGroups);
				ViewGroups.SortDescriptions.Add(new SortDescription("SortName", ListSortDirection.Ascending));

				ViewSearchResults = CollectionViewSource.GetDefaultView(SearchResults);
				ViewSearchResults.SortDescriptions.Add(new SortDescription("MainTitle", 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;

				txtGroupName.Text = defaultGroupName;
				txtGroupSortName.Text = defaultGroupName;

			}
			catch (Exception ex)
			{
				Utils.ShowErrorMessage(ex);
			}

		}
        private void PopulateAnimeGroups()
        {
            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;
        }
Ejemplo n.º 36
0
        void btnLoadFiles_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!JMMServerVM.Instance.ServerOnline)
                {
                    return;
                }

                ViewFiles.Refresh();

                this.Cursor = Cursors.Wait;
                EnableDisableControls(false);
                List <JMMServerBinary.Contract_VideoLocal> rawVids = new List <JMMServerBinary.Contract_VideoLocal>();

                if (LoadTypeIsRandom)
                {
                    rawVids = JMMServerVM.Instance.clientBinaryHTTP.RandomFileRenamePreview(udRandomFiles.Value.Value, JMMServerVM.Instance.CurrentUser.JMMUserID.Value);

                    /*List<int> testIDs = new List<int>();
                     *
                     *                  testIDs.Add(6041); // Gekijouban Bleach: Fade to Black Kimi no Na o Yobu
                     *                  testIDs.Add(6784); // Fate/Stay Night: Unlimited Blade Works
                     *                  testIDs.Add(5975); // Toaru Majutsu no Index
                     *                  testIDs.Add(7599); // Toaru Majutsu no Index II
                     *                  testIDs.Add(8694); // Gekijouban Toaru Majutsu no Index (movie)
                     *                  testIDs.Add(6071); // Quiz Magic Academy: The Original Animation
                     *                  testIDs.Add(4145); // Amaenaide yo!! Katsu!!
                     *                  testIDs.Add(2369); // Bleach
                     *                  testIDs.Add(69); // One Piece
                     *                  foreach (int animeID in testIDs)
                     *                  {
                     *                          List<JMMServerBinary.Contract_VideoLocal> raws = JMMServerVM.Instance.clientBinaryHTTP.GetVideoLocalsForAnime(animeID,
                     *                                  JMMServerVM.Instance.CurrentUser.JMMUserID.Value);
                     *
                     *                          rawVids.AddRange(raws);
                     *                  }*/
                }

                if (LoadTypeIsAll)
                {
                    rawVids = JMMServerVM.Instance.clientBinaryHTTP.RandomFileRenamePreview(int.MaxValue, JMMServerVM.Instance.CurrentUser.JMMUserID.Value);
                }


                if (LoadTypeIsSeries)
                {
                    Window wdw = Window.GetWindow(this);
                    SelectGroupSeriesForm frm = new SelectGroupSeriesForm();
                    frm.Owner = wdw;
                    frm.Init();

                    bool?result = frm.ShowDialog();
                    if (result.HasValue && result.Value == true)
                    {
                        if (frm.SelectedObject.GetType() == typeof(AnimeGroupVM))
                        {
                            AnimeGroupVM grp = frm.SelectedObject as AnimeGroupVM;
                            foreach (AnimeSeriesVM ser in grp.AllAnimeSeries)
                            {
                                List <JMMServerBinary.Contract_VideoLocal> raws = JMMServerVM.Instance.clientBinaryHTTP.GetVideoLocalsForAnime(ser.AniDB_ID,
                                                                                                                                               JMMServerVM.Instance.CurrentUser.JMMUserID.Value);

                                rawVids.AddRange(raws);
                            }
                        }
                        if (frm.SelectedObject.GetType() == typeof(AnimeSeriesVM))
                        {
                            AnimeSeriesVM ser = frm.SelectedObject as AnimeSeriesVM;
                            List <JMMServerBinary.Contract_VideoLocal> raws = JMMServerVM.Instance.clientBinaryHTTP.GetVideoLocalsForAnime(ser.AniDB_ID,
                                                                                                                                           JMMServerVM.Instance.CurrentUser.JMMUserID.Value);

                            rawVids.AddRange(raws);
                        }
                    }
                }

                foreach (JMMServerBinary.Contract_VideoLocal raw in rawVids)
                {
                    VideoLocalVM        vid = new VideoLocalVM(raw);
                    VideoLocalRenamedVM ren = new VideoLocalRenamedVM();
                    ren.VideoLocalID = vid.VideoLocalID;
                    ren.VideoLocal   = vid;
                    ren.Success      = false;
                    FileResults.Add(ren);
                }

                FileCount = FileResults.Count;

                this.Cursor = Cursors.Arrow;
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
                EnableDisableControls(true);
            }
        }
Ejemplo n.º 37
0
        private void CommandBinding_Edit(object sender, ExecutedRoutedEventArgs e)
        {
            //object obj = lbGroupsSeries.SelectedItem;
            object obj = e.Parameter;
            if (obj == null) return;

            try
            {
                if (obj.GetType() == typeof(AnimeGroupVM))
                {
                    AnimeGroupVM grp = (AnimeGroupVM)obj;

                    if (grp.AnimeGroupID.HasValue)
                    {
                        groupBeforeChanges = new AnimeGroupVM();
                        Cloner.Clone(grp, groupBeforeChanges);
                    }

                    grp.IsReadOnly = false;
                    grp.IsBeingEdited = true;

                }

                if (obj.GetType() == typeof(GroupFilterVM))
                {
                    GroupFilterVM gf = (GroupFilterVM)obj;

                    if (gf.GroupFilterID.HasValue && gf.GroupFilterID.Value!=0)
                    {
                        groupFilterBeforeChanges = new GroupFilterVM();
                        groupFilterBeforeChanges.FilterName = gf.FilterName;
                        groupFilterBeforeChanges.BaseCondition = gf.BaseCondition;
                        groupFilterBeforeChanges.ApplyToSeries = gf.ApplyToSeries;
                        groupFilterBeforeChanges.FilterConditions = new ObservableCollection<GroupFilterConditionVM>();
                        groupFilterBeforeChanges.SortCriteriaList = new ObservableCollection<GroupFilterSortingCriteria>();

                        foreach (GroupFilterConditionVM gfc_cur in gf.FilterConditions)
                        {
                            GroupFilterConditionVM gfc = new GroupFilterConditionVM();
                            gfc.ConditionOperator = gfc_cur.ConditionOperator;
                            gfc.ConditionParameter = gfc_cur.ConditionParameter;
                            gfc.ConditionType = gfc_cur.ConditionType;
                            gfc.GroupFilterConditionID = gfc_cur.GroupFilterConditionID;
                            gfc.GroupFilterID = gfc_cur.GroupFilterID;
                            groupFilterBeforeChanges.FilterConditions.Add(gfc);
                        }

                        foreach (GroupFilterSortingCriteria gfcs_cur in gf.SortCriteriaList)
                        {
                            GroupFilterSortingCriteria gfsc = new GroupFilterSortingCriteria();
                            gfsc.GroupFilterID = gfcs_cur.GroupFilterID;
                            gfsc.SortDirection = gfcs_cur.SortDirection;
                            gfsc.SortType = gfcs_cur.SortType;
                            groupFilterBeforeChanges.SortCriteriaList.Add(gfsc);
                        }
                        //Cloner.Clone(gf, groupFilterBeforeChanges);
                    }

                    gf.IsLocked = false;
                    gf.IsBeingEdited = true;

                    groupFilterVM = gf;
                    MainListHelperVM.Instance.ViewGroupsForms.Filter = GroupFilter_GroupSearch;
                    MainListHelperVM.Instance.SetGroupFilterSortingOnForms(gf);
                }

                if (obj.GetType() == typeof(AnimeSeriesVM))
                {

                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }

            EnableDisableGroupControls(false);
        }
Ejemplo n.º 38
0
        private bool SetGroupListItem(ref GUIListItem item, AnimeGroupVM grp)
        {
            if (groupViewMode != GUIFacadeControl.Layout.List)
            {
                // Graphical Mode
                item = new GUIListItem();
            }
            else
            {
                string sIconList = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_ListIcon.png"; // MyAnime3\anime3_ListIcon
                //string sUnWatchedFilename = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_UnWatched_left.png";
                item = new GUIListItem(grp.GroupName);

                View.eLabelStyleGroups style = View.eLabelStyleGroups.WatchedUnwatched;

                switch (style)
                {
                    case View.eLabelStyleGroups.WatchedUnwatched:

                        // Available (Files are Local) Images
                        string unwatched = grp.UnwatchedEpisodeCount.ToString();
                        string watched = grp.WatchedEpisodeCount.ToString();
                        string space = " ";

                        //item.Label3 = space + watched.ToString().PadLeft(3, '0');
                        item.Label3 = space + watched.ToString().PadLeft(3, '0');
                        item.IconImage = sIconList;
                        item.Label2 = unwatched.ToString().PadLeft(3, '0');
                        break;

                    /*case View.eLabelStyleGroups.Unwatched:

                        if (grp.UnwatchedEpisodeCount > 0)
                        {
                            item.IconImage = sUnWatchedFilename;
                            item.Label3 = grp.UnwatchedEpisodeCount.ToString() + " New";
                            item.Label2 = "  ";
                        }
                        else
                        {
                            item.Label2 = "  ";
                            item.Label3 = "  ";
                        }
                        break;

                    case View.eLabelStyleGroups.TotalEpisodes:

                        int totalEps = grp.UnwatchedEpisodeCount + grp.WatchedEpisodeCount;

                        item.IconImage = sUnWatchedFilename;
                        item.Label3 = totalEps.ToString() + " Eps";
                        item.Label2 = "  ";

                        break;*/
                }
            }
            item.DVDLabel = grp.GroupName;
            item.TVTag = grp;
            item.IsPlayed = (grp.UnwatchedEpisodeCount == 0);

            return true;
        }
Ejemplo n.º 39
0
        private void CommandBinding_AddSubGroup(object sender, ExecutedRoutedEventArgs e)
        {
            AnimeGroupVM grp = e.Parameter as AnimeGroupVM;
            if (grp == null) return;

            try
            {
                AnimeGroupVM grpNew = new AnimeGroupVM();
                grpNew.IsReadOnly = false;
                grpNew.IsBeingEdited = true;
                grpNew.AnimeGroupParentID = grp.AnimeGroupID.Value;
                SetDetailBinding(grpNew);
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
Ejemplo n.º 40
0
        protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)
        {
            if (actionType == MediaPortal.GUI.Library.Action.ActionType.ACTION_MOUSE_DOUBLECLICK)
            {
                OnShowContextMenu();
                return;
            }

            if (actionType == MediaPortal.GUI.Library.Action.ActionType.ACTION_PLAY)
            {
                if (MediaPortal.Player.g_Player.Playing == false)
                    BaseConfig.MyAnimeLog.Write("Pressed the play button");
            }

            if (this.btnDisplayOptions != null && control == this.btnDisplayOptions)
            {
                hook.IsEnabled = false;

                ShowDisplayOptionsMenu("");
                btnDisplayOptions.Focus = false;

                Thread.Sleep(100); //make sure key-up's from the context menu aren't cought by the hook
                hook.IsEnabled = true;

                this.btnDisplayOptions.IsFocused = false;

                return;
            }

            if (this.btnWindowUtilities != null && control == this.btnWindowUtilities)
            {
                SetGlobalIDs();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.ADMIN);

                this.btnWindowUtilities.IsFocused = false;

                return;
            }

            if (this.btnWindowCalendar != null && control == this.btnWindowCalendar)
            {
                SetGlobalIDs();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.CALENDAR);
                //GUIWindowManager.ActivateWindow(Constants.WindowIDs.BROWSER);

                this.btnWindowCalendar.IsFocused = false;

                return;
            }

            if (this.btnWindowDownloads != null && control == this.btnWindowDownloads)
            {
                SetGlobalIDs();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.DOWNLOADS);

                this.btnWindowDownloads.IsFocused = false;
                return;
            }

            if (this.btnWindowContinueWatching != null && control == this.btnWindowContinueWatching)
            {
                SetGlobalIDs();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.WATCHING);

                this.btnWindowContinueWatching.IsFocused = false;
                return;
            }

            if (this.btnWindowRecommendations != null && control == this.btnWindowRecommendations)
            {
                SetGlobalIDs();
                GUIWindowManager.ActivateWindow(Constants.WindowIDs.RECOMMENDATIONS);

                this.btnWindowRecommendations.IsFocused = false;
                return;
            }

            if (this.btnWindowRandom != null && control == this.btnWindowRandom)
            {

                RandomWindow_LevelObject = GroupFilterHelper.AllGroupsFilter;
                RandomWindow_RandomLevel = RandomSeriesEpisodeLevel.GroupFilter;
                RandomWindow_RandomType = RandomObjectType.Series;

                GUIWindowManager.ActivateWindow(Constants.WindowIDs.RANDOM);

                this.btnWindowRandom.IsFocused = false;
                return;
            }

            if (this.btnChangeLayout != null && control == this.btnChangeLayout)
            {
                ShowLayoutMenu("");
                this.btnChangeLayout.IsFocused = false;
                return;
            }

            if (this.btnSwitchUser != null && control == this.btnSwitchUser)
            {
                if (JMMServerVM.Instance.PromptUserLogin())
                {
                    listLevel = Listlevel.GroupFilter;
                    curAnimeEpisode = null;
                    curAnimeGroup = null;
                    curAnimeSeries = null;
                    curGroupFilter = null;

                    // user has logged in, so save to settings so we will log in as the same user next time
                    settings.CurrentJMMUserID = JMMServerVM.Instance.CurrentUser.JMMUserID.ToString();
                    settings.Save();

                    LoadFacade();
                }

                this.btnSwitchUser.IsFocused = false;
                return;
            }

            if (this.btnSettings != null && control == this.btnSettings)
            {
                hook.IsEnabled = false;

                ShowOptionsDisplayMenu("");
                btnDisplayOptions.Focus = false;

                Thread.Sleep(100); //make sure key-up's from the context menu aren't cought by the hook
                hook.IsEnabled = true;

                this.btnSettings.IsFocused = false;

                return;
            }

            try
            {
                if (actionType != MediaPortal.GUI.Library.Action.ActionType.ACTION_SELECT_ITEM) return; // some other events raised onClicked too for some reason?
                if (control == this.m_Facade)
                {
                    UpdateSearchPanel(false);

                    if (this.m_Facade.SelectedListItem == null || this.m_Facade.SelectedListItem.TVTag == null)
                        return;

                    switch (listLevel)
                    {
                        case Listlevel.GroupFilter:
                            curGroupFilter = this.m_Facade.SelectedListItem.TVTag as GroupFilterVM;
                            if (curGroupFilter == null) return;

                            if (curGroupFilter.GroupFilterID.Value == Constants.StaticGF.Predefined)
                            {
                                listLevel = Listlevel.GroupFilterSub;
                                curGroupFilterSub2 = null;
                                curGroupFilterSub = null;
                            }
                            else
                            {
                                listLevel = Listlevel.Group;
                                curGroupFilterSub2 = null;
                                curGroupFilterSub = null;
                            }

                            LoadFacade();
                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.GroupFilterSub:
                            curGroupFilterSub = this.m_Facade.SelectedListItem.TVTag as GroupFilterVM;
                            if (curGroupFilterSub == null) return;

                            curGroupFilterSub2 = null;
                            listLevel = Listlevel.GroupFilterSub2;

                            LoadFacade();
                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.GroupFilterSub2:
                            curGroupFilterSub2 = this.m_Facade.SelectedListItem.TVTag as GroupFilterVM;
                            if (curGroupFilterSub2 == null) return;

                            listLevel = Listlevel.Group;

                            LoadFacade();
                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.Group:
                            curAnimeGroup = this.m_Facade.SelectedListItem.TVTag as AnimeGroupVM;
                            if (curAnimeGroup == null) return;
                            curAnimeGroupViewed = curAnimeGroup;

                            // e.g. if there is only one series for the group, show the episode types
                            // if there is only for episode type for the series show the episodes
                            ShowChildrenLevelForGroup();

                            LoadFacade();
                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.Series:

                            if (this.m_Facade.SelectedListItem.TVTag == null) return;

                            // sub groups
                            if (this.m_Facade.SelectedListItem.TVTag.GetType() == typeof(AnimeGroupVM))
                            {
                                curAnimeGroup = this.m_Facade.SelectedListItem.TVTag as AnimeGroupVM;
                                if (curAnimeGroup == null) return;
                                curAnimeGroupViewed = curAnimeGroup;

                                ShowChildrenLevelForGroup();
                            }
                            else if (this.m_Facade.SelectedListItem.TVTag.GetType() == typeof(AnimeSeriesVM))
                            {
                                curAnimeSeries = this.m_Facade.SelectedListItem.TVTag as AnimeSeriesVM;
                                if (curAnimeSeries == null) return;

                                ShowChildrenLevelForSeries();
                            }

                            LoadFacade();
                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.EpisodeTypes:
                            curAnimeEpisodeType = this.m_Facade.SelectedListItem.TVTag as AnimeEpisodeTypeVM;
                            if (curAnimeEpisodeType == null) return;

                            listLevel = Listlevel.Episode;
                            SetFanartForEpisodes();
                            LoadFacade();

                            this.m_Facade.Focus = true;

                            break;

                        case Listlevel.Episode:
                            this.curAnimeEpisode = this.m_Facade.SelectedListItem.TVTag as AnimeEpisodeVM;
                            if (curAnimeEpisode == null) return;

                            BaseConfig.MyAnimeLog.Write("Selected to play: {0}", curAnimeEpisode.EpisodeNumberAndName);
                            vidHandler.ResumeOrPlay(curAnimeEpisode);

                            break;
                    }
                }
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("Error in OnClicked: {0} - {1}", ex.Message, ex.ToString());
            }

            base.OnClicked(controlId, control, actionType);
        }
Ejemplo n.º 41
0
        public static List<AnimeGroupVM> GetSubGroupsForGroup(AnimeGroupVM grp)
        {
            DateTime start = DateTime.Now;

            List<AnimeGroupVM> allGroups = new List<AnimeGroupVM>();

            try
            {
                List<JMMServerBinary.Contract_AnimeGroup> rawGroups = JMMServerVM.Instance.clientBinaryHTTP.GetSubGroupsForGroup(grp.AnimeGroupID,
                    JMMServerVM.Instance.CurrentUser.JMMUserID);
                if (rawGroups == null) return allGroups;

                foreach (JMMServerBinary.Contract_AnimeGroup contract in rawGroups)
                    allGroups.Add(new AnimeGroupVM(contract));

                TimeSpan ts = DateTime.Now - start;
                string msg = string.Format("Got sub groups for group: {0} - {1} in {2} ms", grp.GroupName, allGroups.Count, ts.TotalMilliseconds);
                BaseConfig.MyAnimeLog.Write(msg);
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write(ex.ToString());
            }
            return allGroups;
        }
Ejemplo n.º 42
0
        void btnOK_Click(object sender, RoutedEventArgs e)
        {
            int? groupID = null;

            if (IsExistingGroup)
            {
                if (lbGroups.SelectedItem == null)
                {
                    MessageBox.Show(Properties.Resources.MSG_ERR_GroupSelectionRequired, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    lbGroups.Focus();
                    return;
                }
                else
                {
                    SelectedGroup = lbGroups.SelectedItem as AnimeGroupVM;
                    this.DialogResult = true;
                    this.Close();
                }

            }

            if (IsNewGroup)
            {
                if (txtGroupName.Text.Trim().Length == 0)
                {
                    MessageBox.Show(Properties.Resources.MSG_ERR_GroupNameRequired, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    txtGroupName.Focus();
                    return;
                }

                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.ViewGroups.Refresh();
                        groupID = grp.AnimeGroupID;
                    }

                }
                SelectedGroup = grp;
                this.DialogResult = true;
                this.Close();
            }
        }
Ejemplo n.º 43
0
        private IVM GetChildrenLevelForGroup(AnimeGroupVM vm)
        {
            List<AnimeGroupVM> subGroups = vm.SubGroups;
              List<AnimeSeriesVM> seriesList = vm.ChildSeries;

              int subLevelCount = seriesList.Count + subGroups.Count;

              if (subLevelCount > 1 || subLevelCount == 0)
            return vm;
              // keep drilling down until we find a series
              // or more than one sub level
              while (subLevelCount == 1 && subGroups.Count > 0)
              {
            vm = subGroups[0];
            subGroups = vm.SubGroups;
            seriesList = vm.ChildSeries;
            subLevelCount = seriesList.Count + subGroups.Count;
              }

              if (subGroups.Count == 0 && (seriesList.Count == 1))
              {
            return GetChildrenLevelForSeries(seriesList[0]);
              }
              return vm;
        }
Ejemplo n.º 44
0
 private void CommandBinding_NewGroup(object sender, ExecutedRoutedEventArgs e)
 {
     try
     {
         AnimeGroupVM grpNew = new AnimeGroupVM();
         grpNew.IsReadOnly = false;
         grpNew.IsBeingEdited = true;
         SetDetailBinding(grpNew);
     }
     catch (Exception ex)
     {
         Utils.ShowErrorMessage(ex);
     }
 }
Ejemplo n.º 45
0
        public static string GetWideBannerAsFileName(AnimeGroupVM grp)
        {
            List<string> allBanners = new List<string>();

            if (grp.DefaultAnimeSeriesID.HasValue)
            {
                AnimeSeriesVM ser = grp.DefaultSeries;
                if (ser != null)
                {
                    AniDB_AnimeVM anime = ser.AniDB_Anime;

                    string fileName = GetWideBannerAsFileName(anime);
                    if (!string.IsNullOrEmpty(fileName) && File.Exists(fileName))
                        allBanners.Add(fileName);
                }
            }
            else
            {
                // get all the series for this group
                foreach (AnimeSeriesVM ser in grp.AllSeries)
                {
                    AniDB_AnimeVM anime = ser.AniDB_Anime;

                    string fileName = GetWideBannerAsFileName(anime);
                    if (!string.IsNullOrEmpty(fileName) && File.Exists(fileName))
                        allBanners.Add(fileName);
                }
            }

            if (allBanners.Count == 0) return "";

            return allBanners[bannerRandom.Next(0, allBanners.Count - 1)];
        }
 public void Init(AnimeGroupVM grp)
 {
     SeriesForGroup = grp.AllAnimeSeries;
 }
Ejemplo n.º 47
0
        private void ShowParentLevelForGroup(AnimeGroupVM grp)
        {
            while (grp != null)
            {
                List<AnimeGroupVM> subGroups = grp.SubGroups;
                List<AnimeSeriesVM> seriesList = grp.ChildSeries;

                if ((seriesList.Count + subGroups.Count) > 1)
                {
                    curAnimeGroupViewed = grp;
                    curAnimeGroup = grp;

                    listLevel = Listlevel.Series;
                    return;
                }
                else
                {
                    // go up one level
                    if (grp.AnimeGroupParentID.HasValue)
                        grp = grp.ParentGroup;
                    else
                    {
                        // only one series or subgroup so go all the way back to the group list
                        listLevel = Listlevel.Group;
                        curAnimeEpisodeType = null;
                        curAnimeSeries = null;
                        return;
                    }
                }
            }
        }
Ejemplo n.º 48
0
        public override void OnAction(MediaPortal.GUI.Library.Action action)
        {
            //BaseConfig.MyAnimeLog.Write("Received action: {0}/{1}", action.wID, (char)(action.m_key.KeyChar));

            switch (action.wID)
            {
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_DOWN:
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_UP:

                    //Reset autoclose timer on search
                    if (searchTimer.Enabled)
                    {
                        searchTimer.Stop();
                        searchTimer.Start();
                    }

                    base.OnAction(action);
                    break;
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_LEFT:
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_RIGHT:

                    base.OnAction(action);
                    break;
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_KEY_PRESSED:

                    //when the list is selected, search the input
                    if (GUIWindowManager.ActiveWindowEx == this.GetID)
                    {
                        if ((m_Facade.CurrentLayout == GUIFacadeControl.Layout.List && m_Facade.ListLayout.IsFocused)
                            || (m_Facade.CurrentLayout == GUIFacadeControl.Layout.LargeIcons && m_Facade.ThumbnailLayout.IsFocused)
                            || (m_Facade.CurrentLayout == GUIFacadeControl.Layout.Filmstrip && m_Facade.FilmstripLayout.IsFocused)
                            || (m_Facade.CurrentLayout == GUIFacadeControl.Layout.CoverFlow && m_Facade.CoverFlowLayout.IsFocused))
                            OnSearchChar((char)(action.m_key.KeyChar));
                    }
                    break;

                case MediaPortal.GUI.Library.Action.ActionType.ACTION_PARENT_DIR:
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_HOME:
                    UpdateSearchPanel(false);
                    ImageAllocator.FlushAll();
                    GUIWindowManager.ShowPreviousWindow();
                    break;

                case MediaPortal.GUI.Library.Action.ActionType.ACTION_PLAY:
                    BaseConfig.MyAnimeLog.Write("Received PLAY action");

                    try
                    {
                        if (listLevel == Listlevel.Group)
                        {
                            if (curAnimeGroup == null) return;
                            JMMServerBinary.Contract_AnimeEpisode contract = JMMServerVM.Instance.clientBinaryHTTP.GetNextUnwatchedEpisodeForGroup(curAnimeGroup.AnimeGroupID,
                                JMMServerVM.Instance.CurrentUser.JMMUserID);
                            if (contract == null) return;
                            AnimeEpisodeVM ep = new AnimeEpisodeVM(contract);
                            vidHandler.ResumeOrPlay(ep);
                        }

                        if (listLevel == Listlevel.Series)
                        {
                            //curAnimeSeries = null;
                            if (curAnimeSeries == null) return;
                            JMMServerBinary.Contract_AnimeEpisode contract = JMMServerVM.Instance.clientBinaryHTTP.GetNextUnwatchedEpisode(curAnimeSeries.AnimeSeriesID.Value,
                                JMMServerVM.Instance.CurrentUser.JMMUserID);
                            if (contract == null) return;
                            AnimeEpisodeVM ep = new AnimeEpisodeVM(contract);
                            vidHandler.ResumeOrPlay(ep);
                        }
                    }
                    catch (Exception ex)
                    {
                        BaseConfig.MyAnimeLog.Write(ex.ToString());
                    }
                    break;

                case MediaPortal.GUI.Library.Action.ActionType.ACTION_PREVIOUS_MENU:
                    if (searchTimer.Enabled)
                    {
                        OnSearchAction(SearchAction.EndSearch);
                        return;
                    }

                    // back one level
                    if (listLevel == Listlevel.GroupFilter)
                    {
                        goto case MediaPortal.GUI.Library.Action.ActionType.ACTION_HOME;
                    }
                    else
                    {
                        string msg = string.Format("LIST LEVEL:: {0} - GF: {1} - GFSub2: {2}", listLevel, curGroupFilter, curGroupFilterSub2);

                        BaseConfig.MyAnimeLog.Write(msg);
                        if (listLevel == Listlevel.GroupFilterSub)
                        {
                            listLevel = Listlevel.GroupFilter;
                            curGroupFilterSub = null;

                            LoadFacade();
                        }
                        if (listLevel == Listlevel.GroupFilterSub2)
                        {
                            // go back to GROUP FILTERS
                            listLevel = Listlevel.GroupFilterSub;
                            curGroupFilterSub2 = null;

                            LoadFacade();
                        }
                        if (listLevel == Listlevel.Group)
                        {
                            if (curGroupFilterSub2 == null)
                            {
                                // go back to GROUP FILTERS
                                listLevel = Listlevel.GroupFilter;
                            }
                            else
                            {
                                listLevel = Listlevel.GroupFilterSub2;
                            }
                            LoadFacade();
                            curAnimeGroup = null;
                        }

                        if (listLevel == Listlevel.Series)
                        {
                            // go back to GROUP
                            AnimeGroupVM parentGroup = curAnimeGroupViewed.ParentGroup;
                            if (parentGroup == null)
                                listLevel = Listlevel.Group;

                            ShowParentLevelForGroup(parentGroup);

                            LoadFacade();
                            curAnimeEpisodeType = null;
                            curAnimeSeries = null;
                        }

                        if (listLevel == Listlevel.EpisodeTypes)
                        {
                            // go back to SERIES
                            AnimeSeriesVM parentSeries = curAnimeEpisodeType.AnimeSeries;
                            ShowParentLevelForSeries(parentSeries);
                            LoadFacade();
                            return;
                        }

                        if (listLevel == Listlevel.Episode)
                        {
                            AnimeSeriesVM parentSeries = curAnimeEpisodeType.AnimeSeries;
                            if (parentSeries.EpisodeTypesToDisplay.Count == 1)
                                ShowParentLevelForSeries(parentSeries);
                            else
                            {
                                listLevel = Listlevel.EpisodeTypes;
                                curAnimeEpisodeType = null;
                            }

                            LoadFacade();
                            return;
                        }
                    }
                    break;

                default:
                    base.OnAction(action);
                    break;
            }
        }
Ejemplo n.º 49
0
        private List <AnimeSeriesVM> GetSeriesForGroup()
        {
            List <AnimeSeriesVM> serList = new List <AnimeSeriesVM>();

            try
            {
                if (LevelType != RandomSeriesEpisodeLevel.Group)
                {
                    return(serList);
                }
                AnimeGroupVM grp = LevelObject as AnimeGroupVM;
                if (grp == null)
                {
                    return(serList);
                }

                foreach (AnimeSeriesVM ser in grp.AllAnimeSeries)
                {
                    // tags
                    if (!string.IsNullOrEmpty(SelectedTags))
                    {
                        string filterParm = SelectedTags.Trim();

                        string[] cats = filterParm.Split(',');

                        bool foundCat = false;
                        if (cboCatFilter.SelectedIndex == 1)
                        {
                            foundCat = true;                                  // all
                        }
                        int index = 0;
                        foreach (string cat in cats)
                        {
                            if (cat.Trim().Length == 0)
                            {
                                continue;
                            }
                            if (cat.Trim() == ",")
                            {
                                continue;
                            }

                            bool fnd = ser.AllTags.Contains(cat, StringComparer.InvariantCultureIgnoreCase);

                            if (cboCatFilter.SelectedIndex == 0)                             // any
                            {
                                if (fnd)
                                {
                                    foundCat = true;
                                    break;
                                }
                            }
                            else                             //all
                            {
                                if (!fnd)
                                {
                                    foundCat = false;
                                    break;
                                }
                            }
                        }
                        if (!foundCat)
                        {
                            continue;
                        }
                    }

                    serList.Add(ser);
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }

            return(serList);
        }
Ejemplo n.º 50
0
		public static bool EvaluateGroupFilter(GroupFilterVM gf, AnimeGroupVM grp)
		{
			return gf.EvaluateGroupFilter(grp);
		}
Ejemplo n.º 51
0
        private List <AnimeSeriesVM> GetSeriesForGroupFilter()
        {
            List <AnimeSeriesVM> serList = new List <AnimeSeriesVM>();

            try
            {
                BaseConfig.MyAnimeLog.Write("Getting list of candidate random series");

                if (MainWindow.RandomWindow_RandomLevel != RandomSeriesEpisodeLevel.GroupFilter)
                {
                    return(serList);
                }
                GroupFilterVM gf = MainWindow.RandomWindow_LevelObject as GroupFilterVM;
                if (gf == null)
                {
                    return(serList);
                }

                BaseConfig.MyAnimeLog.Write("Getting list of candidate random series for: " + gf.GroupFilterName);

                bool allCats = MainWindow.RandomWindow_SeriesAllCategories;
                if (MainWindow.RandomWindow_RandomType == RandomObjectType.Episode)
                {
                    allCats = MainWindow.RandomWindow_EpisodeAllCategories;
                }

                bool completeSeries   = true;
                bool allWatched       = true;
                bool unwatched        = true;
                bool partiallyWatched = true;

                if (togWatched != null)
                {
                    allWatched = togWatched.Selected;
                }
                if (togUnwatched != null)
                {
                    unwatched = togUnwatched.Selected;
                }
                if (togPartiallyWatched != null)
                {
                    partiallyWatched = togPartiallyWatched.Selected;
                }
                if (togCompleteOnly != null)
                {
                    completeSeries = togCompleteOnly.Selected;
                }

                List <JMMServerBinary.Contract_AnimeGroup> contracts = JMMServerVM.Instance.clientBinaryHTTP.GetAnimeGroupsForFilter(
                    gf.GroupFilterID.Value, JMMServerVM.Instance.CurrentUser.JMMUserID, BaseConfig.Settings.SingleSeriesGroups);

                BaseConfig.MyAnimeLog.Write("Total groups for filter = " + contracts.Count.ToString());

                string selectedCategories = MainWindow.RandomWindow_SeriesCategories;
                if (MainWindow.RandomWindow_RandomType == RandomObjectType.Episode)
                {
                    selectedCategories = MainWindow.RandomWindow_EpisodeCategories;
                }

                foreach (JMMServerBinary.Contract_AnimeGroup grpContract in contracts)
                {
                    AnimeGroupVM grp = new AnimeGroupVM(grpContract);
                    // ignore sub groups
                    if (grp.AnimeGroupParentID.HasValue)
                    {
                        continue;
                    }

                    foreach (AnimeSeriesVM ser in grp.AllSeries)
                    {
                        // categories
                        if (!string.IsNullOrEmpty(selectedCategories))
                        {
                            string filterParm = selectedCategories.Trim();

                            string[] cats = filterParm.Split(',');

                            bool foundCat = false;
                            if (allCats)
                            {
                                foundCat = true;                                      // all
                            }
                            int index = 0;
                            foreach (string cat in cats)
                            {
                                string thiscat = cat.Trim();
                                if (thiscat.Trim().Length == 0)
                                {
                                    continue;
                                }
                                if (thiscat.Trim() == ",")
                                {
                                    continue;
                                }

                                index = ser.CategoriesString.IndexOf(thiscat, 0, StringComparison.InvariantCultureIgnoreCase);

                                if (!allCats)                                 // any
                                {
                                    if (index > -1)
                                    {
                                        foundCat = true;
                                        break;
                                    }
                                }
                                else                                 //all
                                {
                                    if (index < 0)
                                    {
                                        foundCat = false;
                                        break;
                                    }
                                }
                            }
                            if (!foundCat)
                            {
                                continue;
                            }
                        }

                        if (!ser.IsComplete && completeSeries)
                        {
                            continue;
                        }

                        if (allWatched && ser.AllFilesWatched)
                        {
                            serList.Add(ser);
                            continue;
                        }

                        if (unwatched && !ser.AnyFilesWatched)
                        {
                            serList.Add(ser);
                            continue;
                        }


                        if (partiallyWatched && ser.AnyFilesWatched && !ser.AllFilesWatched)
                        {
                            serList.Add(ser);
                            continue;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write(ex.ToString());
            }

            return(serList);
        }
        void btnConfirm_Click(object sender, RoutedEventArgs e)
        {
            // get the details from the form
            groupFilterCondition.ConditionType     = (int)GroupFilterHelper.GetEnumForText_ConditionType(cboConditionType.SelectedItem.ToString());
            groupFilterCondition.ConditionOperator = (int)GroupFilterHelper.GetEnumForText_Operator(cboConditionOperator.SelectedItem.ToString());

            NumberStyles style   = NumberStyles.Number;
            CultureInfo  culture = CultureInfo.CreateSpecificCulture("en-GB");


            // get the parameter details
            if (IsParameterDate)
            {
                if (dpDate.SelectedDate == null)
                {
                    MessageBox.Show(Properties.Resources.MSG_ERR_SelectDate, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    dpDate.Focus();
                    return;
                }
                else
                {
                    groupFilterCondition.ConditionParameter = GroupFilterHelper.GetDateAsString(dpDate.SelectedDate.Value);
                }
            }

            if (IsParameterRating)
            {
                if (txtParameter.Text.Trim().Length == 0)
                {
                    MessageBox.Show(Properties.Resources.MSG_ERR_EnterValue, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    txtParameter.Focus();
                    return;
                }
                else
                {
                    decimal dRating = -1;
                    decimal.TryParse(txtParameter.Text, style, culture, out dRating);
                    if (dRating <= 0 || dRating > 10)
                    {
                        MessageBox.Show(Properties.Resources.MSG_ERR_RatingValue, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                        txtParameter.Focus();
                        return;
                    }

                    groupFilterCondition.ConditionParameter = txtParameter.Text.Trim();
                }
            }

            if (IsParameterInteger)
            {
                if (txtParameter.Text.Trim().Length == 0)
                {
                    MessageBox.Show(Properties.Resources.MSG_ERR_EnterValue, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    txtParameter.Focus();
                    return;
                }
                else
                {
                    int parmInt = -1;
                    if (!int.TryParse(txtParameter.Text, out parmInt))
                    {
                        MessageBox.Show(Properties.Resources.GroupFilter_IntegerOnly, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                        txtParameter.Focus();
                        return;
                    }

                    groupFilterCondition.ConditionParameter = parmInt.ToString();
                }
            }

            if (IsParameterLastXDays)
            {
                if (txtParameter.Text.Trim().Length == 0)
                {
                    MessageBox.Show(Properties.Resources.MSG_ERR_EnterValue, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    txtParameter.Focus();
                    return;
                }
                else
                {
                    int days = -1;
                    int.TryParse(txtParameter.Text, out days);
                    if (days < 1 || days > int.MaxValue)
                    {
                        MessageBox.Show(Properties.Resources.MSG_ERR_DaysValue, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                        txtParameter.Focus();
                        return;
                    }

                    groupFilterCondition.ConditionParameter = txtParameter.Text.Trim();
                }
            }


            if (IsParameterTag)
            {
                if (txtSelectedTags.Text.Trim().Length == 0)
                {
                    MessageBox.Show(Properties.Resources.MSG_ERR_EnterValue, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    txtParameter.Focus();
                    return;
                }
                else
                {
                    // validate
                    string[] cats = txtSelectedTags.Text.Trim().Split(',');
                    groupFilterCondition.ConditionParameter = "";
                    foreach (string cat in cats)
                    {
                        if (cat.Trim().Length == 0)
                        {
                            continue;
                        }
                        if (cat.Trim() == ", ")
                        {
                            continue;
                        }

                        if (groupFilterCondition.ConditionParameter.Length > 0)
                        {
                            groupFilterCondition.ConditionParameter += ", ";
                        }
                        groupFilterCondition.ConditionParameter += cat;
                    }
                }
            }

            if (IsParameterCustomTag)
            {
                if (txtSelectedCustomTags.Text.Trim().Length == 0)
                {
                    MessageBox.Show(Properties.Resources.MSG_ERR_EnterValue, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    txtSelectedCustomTags.Focus();
                    return;
                }
                else
                {
                    // validate
                    string[] tags = txtSelectedCustomTags.Text.Trim().Split(',');
                    groupFilterCondition.ConditionParameter = "";
                    foreach (string tag in tags)
                    {
                        if (tag.Trim().Length == 0)
                        {
                            continue;
                        }
                        if (tag.Trim() == ", ")
                        {
                            continue;
                        }

                        if (groupFilterCondition.ConditionParameter.Length > 0)
                        {
                            groupFilterCondition.ConditionParameter += ", ";
                        }
                        groupFilterCondition.ConditionParameter += tag;
                    }
                }
            }

            if (IsParameterVideoQuality)
            {
                if (txtSelectedVideoQuality.Text.Trim().Length == 0)
                {
                    MessageBox.Show(Properties.Resources.MSG_ERR_EnterValue, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    txtParameter.Focus();
                    return;
                }
                else
                {
                    // validate
                    string[] vidQuals = txtSelectedVideoQuality.Text.Trim().Split(',');
                    groupFilterCondition.ConditionParameter = "";
                    foreach (string vidq in vidQuals)
                    {
                        if (vidq.Trim().Length == 0)
                        {
                            continue;
                        }
                        if (vidq.Trim() == ", ")
                        {
                            continue;
                        }

                        if (groupFilterCondition.ConditionParameter.Length > 0)
                        {
                            groupFilterCondition.ConditionParameter += ", ";
                        }
                        groupFilterCondition.ConditionParameter += vidq;
                    }
                }
            }

            if (IsParameterAudioLanguage)
            {
                if (txtSelectedAudioLanguages.Text.Trim().Length == 0)
                {
                    MessageBox.Show(Properties.Resources.MSG_ERR_EnterValue, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    txtParameter.Focus();
                    return;
                }
                else
                {
                    // validate
                    string[] languages = txtSelectedAudioLanguages.Text.Trim().Split(',');
                    groupFilterCondition.ConditionParameter = "";
                    foreach (string lanName in languages)
                    {
                        if (lanName.Trim().Length == 0)
                        {
                            continue;
                        }
                        if (lanName.Trim() == ", ")
                        {
                            continue;
                        }

                        if (groupFilterCondition.ConditionParameter.Length > 0)
                        {
                            groupFilterCondition.ConditionParameter += ", ";
                        }
                        groupFilterCondition.ConditionParameter += lanName;
                    }
                }
            }

            if (IsParameterSubtitleLanguage)
            {
                if (txtSelectedSubtitleLanguages.Text.Trim().Length == 0)
                {
                    MessageBox.Show(Properties.Resources.MSG_ERR_EnterValue, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    txtParameter.Focus();
                    return;
                }
                else
                {
                    // validate
                    string[] languages = txtSelectedSubtitleLanguages.Text.Trim().Split(',');
                    groupFilterCondition.ConditionParameter = "";
                    foreach (string lanName in languages)
                    {
                        if (lanName.Trim().Length == 0)
                        {
                            continue;
                        }
                        if (lanName.Trim() == ", ")
                        {
                            continue;
                        }

                        if (groupFilterCondition.ConditionParameter.Length > 0)
                        {
                            groupFilterCondition.ConditionParameter += ", ";
                        }
                        groupFilterCondition.ConditionParameter += lanName;
                    }
                }
            }

            if (IsParameterAnimeType)
            {
                if (txtSelectedAnimeTypes.Text.Trim().Length == 0)
                {
                    MessageBox.Show(Properties.Resources.MSG_ERR_EnterValue, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    txtParameter.Focus();
                    return;
                }
                else
                {
                    // validate
                    string[] aTypes = txtSelectedAnimeTypes.Text.Trim().Split(',');
                    groupFilterCondition.ConditionParameter = "";
                    foreach (string aType in aTypes)
                    {
                        if (aType.Trim().Length == 0)
                        {
                            continue;
                        }
                        if (aType.Trim() == ", ")
                        {
                            continue;
                        }

                        if (groupFilterCondition.ConditionParameter.Length > 0)
                        {
                            groupFilterCondition.ConditionParameter += ", ";
                        }
                        groupFilterCondition.ConditionParameter += aType;
                    }
                }
            }

            if (IsParameterAnimeGroup)
            {
                if (lbGroups.SelectedItem == null)
                {
                    MessageBox.Show(Properties.Resources.MSG_ERR_GroupSelectionRequired, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    lbGroups.Focus();
                    return;
                }
                else
                {
                    AnimeGroupVM grp = lbGroups.SelectedItem as AnimeGroupVM;
                    groupFilterCondition.ConditionParameter = grp.AnimeGroupID.Value.ToString();
                }
            }

            if (IsParameterText)
            {
                if (txtParameter.Text.Trim().Length == 0)
                {
                    MessageBox.Show(Properties.Resources.MSG_ERR_EnterValue, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    txtParameter.Focus();
                    return;
                }
                else
                {
                    groupFilterCondition.ConditionParameter = txtParameter.Text.Trim();
                }
            }

            this.DialogResult = true;
            this.Close();
        }
Ejemplo n.º 53
0
		public bool EvaluateGroup(AnimeGroupVM grp)
		{
			// make sure the user has not filtered this out
			if (!string.IsNullOrEmpty(JMMServerVM.Instance.CurrentUser.HideCategories))
			{
				return EvaluateCategoryString(grp.Stat_AllCategories);
			}

			return true;
		}
Ejemplo n.º 54
0
        void btnConfirm_Click(object sender, RoutedEventArgs e)
        {
            //AnimeGroupVM grp = null;
            int animeID = 0;
            int?groupID = null;

            try
            {
                if (IsAnimeNotSelected)
                {
                    MessageBox.Show(Properties.Resources.NewSeries_SelectAnime, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    txtAnimeSearch.Focus();
                    return;
                }

                if (IsExistingGroup)
                {
                    if (lbGroups.SelectedItem == null)
                    {
                        MessageBox.Show(Properties.Resources.MSG_ERR_GroupSelectionRequired, Properties.Resources.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, Properties.Resources.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.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, Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                AnimeSeries = new AnimeSeriesVM(response.AnimeSeries);
                MainListHelperVM.Instance.AllSeriesDictionary[AnimeSeries.AnimeSeriesID.Value] = AnimeSeries;
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }

            this.DialogResult = true;
            this.Close();
        }
Ejemplo n.º 55
0
        public static String GetGroupImage(AnimeGroupVM grp, GUIFacadeControl.Layout viewMode)
        {
            string imgFileName = "";
            Size sz = PosterSize;

            switch (viewMode)
            {
                case GUIFacadeControl.Layout.LargeIcons:
                    imgFileName = GetWideBannerAsFileName(grp); sz = BannerSize; break;
                case GUIFacadeControl.Layout.List:
                case GUIFacadeControl.Layout.AlbumView:
                case GUIFacadeControl.Layout.Filmstrip:
                case GUIFacadeControl.Layout.CoverFlow:
                    imgFileName = GetPosterAsFileName(grp); sz = PosterSize; break;
            }

            //BaseConfig.MyAnimeLog.Write("GetGroupBanner::viewMode: {0} : {1} : {2}", viewMode, imgFileName, grp);

            if (string.IsNullOrEmpty(imgFileName))
            {
                string ident = "series_" + grp.GroupName;
                string sTextureName = buildMemoryImage(drawSimpleBanner(sz, grp.GroupName), ident, sz, true);

                if (sTextureName.Length > 0 && !s_SeriesImageList.Contains(sTextureName)) s_SeriesImageList.Add(sTextureName);
                return sTextureName;
            }
            else
            {
                string sTextureName = "";
                if (imgFileName.Length > 0 && System.IO.File.Exists(imgFileName))
                {
                    sTextureName = buildMemoryImageFromFile(imgFileName, sz);
                }
                return sTextureName;
            }
        }
Ejemplo n.º 56
0
        public static String GetGroupImageAsFileName(AnimeGroupVM grp, GUIFacadeControl.Layout viewMode)
        {
            string imgFileName = "";

            DateTime start = DateTime.Now;

            switch (viewMode)
            {
                case GUIFacadeControl.Layout.LargeIcons:
                    imgFileName = GetWideBannerAsFileName(grp); break;
                case GUIFacadeControl.Layout.List:
                case GUIFacadeControl.Layout.AlbumView:
                case GUIFacadeControl.Layout.Filmstrip:
                case GUIFacadeControl.Layout.CoverFlow:
                    imgFileName = GetPosterAsFileName(grp); break;
            }

            TimeSpan ts = DateTime.Now - start;
            BaseConfig.MyAnimeLog.Write("GetGroupImageAsFileName::: {0} in {1}ms", grp.GroupName, ts.TotalMilliseconds);

            return imgFileName;
        }
Ejemplo n.º 57
0
 private Tuple<Fanart, string> FindFanartForGroupFilter(GroupFilterVM gf)
 {
     if (gf.Childs.Count > 0)
       {
     foreach (int v in gf.Childs.Randomize(gf.Childs.Count))
     {
       Contract_GroupFilter cq = JMMServerVM.Instance.clientBinaryHTTP.GetGroupFilter(v);
       if (cq != null)
       {
     GroupFilterVM gfm = new GroupFilterVM(cq);
     Tuple<Fanart, string> n = FindFanartForGroupFilter(gfm);
     if (n != null)
       return n;
       }
     }
       }
       else if (gf.Groups.ContainsKey(JMMServerVM.Instance.CurrentUser.JMMUserID) && gf.Groups[JMMServerVM.Instance.CurrentUser.JMMUserID].Count > 0)
       {
     foreach (int v in gf.Groups[JMMServerVM.Instance.CurrentUser.JMMUserID].Randomize(gf.Groups.Count))
     {
       Contract_AnimeGroup g = JMMServerVM.Instance.clientBinaryHTTP.GetGroup(v, JMMServerVM.Instance.CurrentUser.JMMUserID);
       if (g != null)
       {
     AnimeGroupVM gvm = new AnimeGroupVM(g);
     Fanart fanart = new Fanart(gvm);
     if (!string.IsNullOrEmpty(fanart.FileName))
     {
       string f = ImageAllocator.GetGroupImageAsFileName(gvm, GUIFacadeControl.Layout.List);
       if (f != null)
         return new Tuple<Fanart, string>(fanart, f);
     }
       }
     }
       }
       return null;
 }