Пример #1
0
        public void TEST_GET_ALL_PEOPLE()
        {
            Console.WriteLine("Starting to get all people");
            DateTime start = DateTime.Now;

            IEnumerable <FilteredCollection> items = TitleCollectionManager.GetAllPeople(null, PeopleRole.Actor);

            List <FilteredCollection> allItems = new List <FilteredCollection>(items);

            Console.WriteLine(string.Format("Done - Took: {0} milliseconds for {1} titles",
                                            (DateTime.Now - start).TotalMilliseconds.ToString(),
                                            allItems.Count));
        }
Пример #2
0
        private void lbPeople_DoubleClick(object sender, EventArgs e)
        {
            List <String> listToEdit = new List <string>();

            foreach (string name in from t in TitleCollectionManager.GetAllPeople(null, PeopleRole.Actor) select t.Name)
            {
                listToEdit.Add(name);
            }

            listToEdit.Sort();
            lbcPersona.DataSource = listToEdit;
            //String name = "Actors";
            //ListEditor editor = new ListEditor(name, listToEdit);
            //List<string> original = listToEdit.ToList<string>();
            //editor.ShowDialog();
            //if (listToEdit.Union(original).Count<string>() != original.Count)
            //{
            //    TitleChanges(null, null);
            //}
        }
Пример #3
0
        public IList <GalleryItem> GetGalleryItems()
        {
            List <GalleryItem> items = new List <GalleryItem>();
            //items.Add(new GalleryItem(_gallery, AllItems, AllItems, this));

            IEnumerable <FilteredCollection> filteredItems = null;

            switch (filterType)
            {
            case TitleFilterType.Genre:
                filteredItems = TitleCollectionManager.GetAllGenres(existingFilters);
                //IEnumerable<FilteredCollectionWithImages> fc = TitleCollectionManager.GetAllGenresWithImages(existingFilters);
                //foreach (FilteredCollectionWithImages gen in fc)
                //{

                //}
                break;

            case TitleFilterType.ParentalRating:
                filteredItems = TitleCollectionManager.GetAllParentalRatings(existingFilters);
                break;

            case TitleFilterType.VideoFormat:
                filteredItems = TitleCollectionManager.GetAllVideoFormats(existingFilters);
                break;

            case TitleFilterType.Runtime:
                filteredItems = TitleCollectionManager.GetAllRuntimes(existingFilters);
                break;

            case TitleFilterType.Year:
                filteredItems = TitleCollectionManager.GetAllYears(existingFilters);
                break;

            case TitleFilterType.Country:
                filteredItems = TitleCollectionManager.GetAllCountries(existingFilters);
                break;

            case TitleFilterType.Tag:
                filteredItems = TitleCollectionManager.GetAllTags(existingFilters);
                break;

            case TitleFilterType.Director:
                filteredItems = TitleCollectionManager.GetAllPeople(existingFilters, PeopleRole.Director);
                break;

            case TitleFilterType.Actor:
                filteredItems = TitleCollectionManager.GetAllPeople(existingFilters, PeopleRole.Actor);
                break;

            case TitleFilterType.UserRating:
                filteredItems = TitleCollectionManager.GetAllUserRatings(existingFilters);
                break;

            case TitleFilterType.DateAdded:
                filteredItems = TitleCollectionManager.GetAllDateAdded(existingFilters);
                break;

            default:
                throw new ArgumentException("Unknown filter type");
            }

            if (filteredItems != null)
            {
                foreach (FilteredCollection item in filteredItems)
                {
                    GalleryItem galleryItem = new GalleryItem(_gallery, item.Name, item.Name, this, item.Count);
                    if (!string.IsNullOrEmpty(item.ImagePath))
                    {
                        //TODO:ASYNC this
                        galleryItem.MenuCoverArt = MovieItem.LoadImage(item.ImagePath);
                    }

                    items.Add(galleryItem);
                }
            }

            return(items);
        }
Пример #4
0
        private void TogglePeople(int selectedPeople)
        {
            if (EditedTitle != null)
            {
                listPersona.Clear();
                switch (selectedPeople)
                {
                case 0:     //Directors
                    lbPeople.DataSource    = EditedTitle.Directors;
                    lbPeople.DisplayMember = "full_name";
                    //listPersona.AddRange(MainEditor._titleCollection.GetAllDirectors.ToArray());
                    IEnumerable <FilteredCollection> directors = TitleCollectionManager.GetAllPeople(null, PeopleRole.Director);
                    foreach (FilteredCollection directorItem in directors)
                    {
                        listPersona.Add(directorItem.Name);
                    }
                    listPersona.Sort();
                    break;

                case 1:     //Writers
                    lbPeople.DataSource    = EditedTitle.Writers;
                    lbPeople.DisplayMember = "full_name";
                    IEnumerable <FilteredCollection> writers = TitleCollectionManager.GetAllPeople(null, PeopleRole.Writer);
                    foreach (FilteredCollection writerItem in writers)
                    {
                        listPersona.Add(writerItem.Name);
                    }
                    listPersona.Sort();
                    break;

                case 2:     //Producers
                    lbPeople.DataSource    = EditedTitle.Producers;
                    lbPeople.DisplayMember = "";
                    IEnumerable <FilteredCollection> producers = TitleCollectionManager.GetAllPeople(null, PeopleRole.Producers);
                    foreach (FilteredCollection producerItem in producers)
                    {
                        listPersona.Add(producerItem.Name);
                    }
                    listPersona.Sort();
                    break;

                case 3:     //Actors
                    lbPeople.DataSource    = EditedTitle.ActingRoles;
                    lbPeople.Tag           = "ActingRoles";
                    lbPeople.DisplayMember = "Display";
                    IEnumerable <FilteredCollection> actors = TitleCollectionManager.GetAllPeople(null, PeopleRole.Actor);
                    foreach (FilteredCollection actorItem in actors)
                    {
                        listPersona.Add(actorItem.Name);
                    }
                    listPersona.Sort();
                    break;

                case 4:     //Non-Actors
                    lbPeople.DataSource    = EditedTitle.NonActingRoles;
                    lbPeople.Tag           = "NonActingRoles";
                    lbPeople.DisplayMember = "Display";
                    break;
                }
                filterPersona.Clear();
                filterPersona.AddRange(listPersona);
                lbcPersona.DataSource = filterPersona;
                lbcPersona.Refresh();
            }
        }