示例#1
0
        public PersonVm SearchPerson(string name)
        {
            var person   = new PersonVm(name);
            var movieRef = new ItemsSourceReference()
            {
                Type = ItemsSourceType.Movie, Filter = ItemsSourceFilter.Cast, Param = name
            };

            person.Movies = GetMovieSource(movieRef);
            movieRef      = new ItemsSourceReference()
            {
                Type = ItemsSourceType.Episode, Filter = ItemsSourceFilter.Cast, Param = name
            };
            person.Episodes = GetMovieSource(movieRef);
            movieRef        = new ItemsSourceReference()
            {
                Type = ItemsSourceType.TVShow, Filter = ItemsSourceFilter.Cast, Param = name
            };
            person.TVShows = GetMovieSource(movieRef);
            movieRef       = new ItemsSourceReference()
            {
                Type = ItemsSourceType.Extern, Filter = ItemsSourceFilter.Cast, Param = name
            };
            person.External = GetMovieSource(movieRef);
            return(person);
        }
示例#2
0
        public IItemsSource SearchShow(string query)
        {
            var movieRef = new ItemsSourceReference()
            {
                Type = ItemsSourceType.TVShow, Filter = ItemsSourceFilter.Title, Param = query
            };

            return(GetMovieSource(movieRef));
        }
示例#3
0
        public void GotoWatchList()
        {
            var movieRef = new ItemsSourceReference()
            {
                Type = ItemsSourceType.WatchList, Filter = ItemsSourceFilter.All
            };

            _appContext.View.GotoMovies(movieRef);
        }
示例#4
0
        public IItemsSource SearchFullText(string query)
        {
            var movieRef = new ItemsSourceReference()
            {
                Type = ItemsSourceType.Movie, Filter = ItemsSourceFilter.FullText, Param = query
            };

            return(GetMovieSource(movieRef));
        }
示例#5
0
        public void GoTo(MovieVm clickedItem)
        {
            var movieRef = new ItemsSourceReference()
            {
                Type = ItemsSourceType.Movie, Filter = ItemsSourceFilter.Id, Param = clickedItem.Id.ToString()
            };

            _appContext.View.GotoMovie(movieRef);
        }
示例#6
0
 public bool TryGetLibraryRef(out ItemsSourceReference reference)
 {
     if (Type != null && Id > 0)
     {
         reference = new ItemsSourceReference(Type.Value, Id);
         return(true);
     }
     reference = null;
     return(false);
 }
        public override ItemsSourceReference GetStateRepresentationInternal()
        {
            var listRef = new ItemsSourceReference()
            {
                Type = ItemsSourceType.TVShow, Filter = ItemsSourceFilter.Title, Param = _query
            };

            if (Selected != null)
            {
                listRef.Selection = Items.IndexOf(Selected);
            }
            return(listRef);
        }
示例#8
0
        public override ItemsSourceReference GetStateRepresentationInternal()
        {
            var listRef = new ItemsSourceReference()
            {
                Type = ItemsSourceType.Episode, Filter = ItemsSourceFilter.Cast, Param = _actor
            };

            if (Selected != null)
            {
                listRef.Selection = Items.IndexOf(Selected);
            }
            return(listRef);
        }
示例#9
0
        public override void GotoDetails()
        {
            switch (_baseDetails.type)
            {
            case Base_type.movie:
                var movieRef = new ItemsSourceReference()
                {
                    Type = ItemsSourceType.Movie, Filter = ItemsSourceFilter.Id, Param = _baseDetails.id.ToString()
                };
                _appContext.View.GotoMovie(movieRef);
                break;

            case Base_type.episode:
                _appContext.View.GotoEpisode(EpisodeVm.GetRef(_baseDetails.tvshowid, _baseDetails.season, _baseDetails.episode) + "n");
                break;
            }
        }
示例#10
0
        public async Task GoTo(ItemsSourceReference itemsSourceReference)
        {
            switch (itemsSourceReference.Type)
            {
            case ItemsSourceType.Episode:
                var episode = await
                              _appContext.XBMC.VideoLibrary.GetEpisodeDetails(Convert.ToInt32(itemsSourceReference.Param),
                                                                              Episode.AllFields());

                var vm = new EpisodeVm(episode.episodedetails, _appContext);

                vm.GoTo();
                break;

            case ItemsSourceType.Movie:
                _appContext.View.GotoMovie(itemsSourceReference);
                break;
            }
        }
示例#11
0
        public IItemsSource GetMovieSource(ItemsSourceReference itemsSourceReference = null)
        {
            IItemsSource itemsSource = null;

            if (itemsSourceReference != null)
            {
                ItemsSourceReference current = null;
                if (_sourcesCache.TryGetValue(itemsSourceReference, out itemsSource))
                {
                    current = itemsSource.GetStateRepresentation();
                }
                if (!itemsSourceReference.Equals(current))
                {
                    switch (itemsSourceReference.Type)
                    {
                    case ItemsSourceType.Movie:
                        switch (itemsSourceReference.Filter)
                        {
                        case ItemsSourceFilter.All:
                            itemsSource = new AllMovieSource(_appContext);
                            break;

                        case ItemsSourceFilter.Cast:
                            itemsSource = new CastMovieSource(_appContext, itemsSourceReference.Param);
                            break;

                        case ItemsSourceFilter.Id:
                            itemsSource = new IdMovieSource(_appContext, int.Parse(itemsSourceReference.Param));
                            break;

                        case ItemsSourceFilter.Title:
                            itemsSource = new TitleMovieSource(_appContext, itemsSourceReference.Param);
                            break;

                        case ItemsSourceFilter.FullText:
                            itemsSource = new FullTextMovieSource(_appContext, itemsSourceReference.Param);
                            break;
                        }
                        break;

                    case ItemsSourceType.Episode:
                        switch (itemsSourceReference.Filter)
                        {
                        case ItemsSourceFilter.Cast:
                            itemsSource = new CastEpisodesSource(_appContext, itemsSourceReference.Param);
                            break;
                        }
                        break;

                    case ItemsSourceType.TVShow:
                        switch (itemsSourceReference.Filter)
                        {
                        case ItemsSourceFilter.Title:
                            itemsSource = new TitleTVShowSource(_appContext, itemsSourceReference.Param);
                            break;

                        case ItemsSourceFilter.Cast:
                            itemsSource = new CastTTVShowSource(_appContext, itemsSourceReference.Param);
                            break;

                        case ItemsSourceFilter.All:
                            itemsSource = new TvShowSource(_appContext);
                            break;

                        case ItemsSourceFilter.Id:
                            itemsSource = new TvShowIdSource(_appContext, int.Parse(itemsSourceReference.Param));
                            break;
                        }
                        break;

                    case ItemsSourceType.WatchList:
                        switch (itemsSourceReference.Filter)
                        {
                        case ItemsSourceFilter.All:
                            itemsSource = new WatchlistMovieSource(_appContext);
                            break;
                        }
                        break;

                    case ItemsSourceType.Season:
                        switch (itemsSourceReference.Filter)
                        {
                        case ItemsSourceFilter.All:
                            itemsSource = new WatchlistMovieSource(_appContext);
                            break;
                        }
                        break;

                    case ItemsSourceType.Extern:
                        switch (itemsSourceReference.Filter)
                        {
                        case ItemsSourceFilter.Cast:
                            itemsSource = new CastTmdbResult(itemsSourceReference.Param);
                            break;

                        case ItemsSourceFilter.Title:
                            itemsSource = new TmdbResult(itemsSourceReference.Param);
                            break;
                        }
                        break;
                    }
                }
                _sourcesCache[itemsSourceReference] = itemsSource;
                current = itemsSource.GetStateRepresentation();
                if ((itemsSource.Selected == null ||
                     itemsSourceReference.Selection != current.Selection) &&
                    itemsSourceReference.Selection >= 0)
                {
                    itemsSource.RestoreSelection(itemsSourceReference.Selection);
                }
            }
            if (itemsSource == null)
            {
                itemsSource = new AllMovieSource(_appContext);
            }
            return(itemsSource);
        }
示例#12
0
        public void GoTo()
        {
            var iRef = new ItemsSourceReference(ItemsSourceType.Movie, Id);

            _appContext.View.GotoMovie(iRef);
        }