コード例 #1
0
        public EpisodeViewModel(ITvShowViewModelFactory viewModelFactory,
                                IEpisodeMetadataService metadataService,
                                ITvShowViewModel tvShowViewModel,
                                IProgressManagerViewModel progressManager,
                                IBusyProvider busyProvider,
                                IDialogViewer dialogViewer,
                                IKeyDataStore keyDataStore,
                                string path)
            : base(busyProvider, dialogViewer)
        {
            _metadataService = metadataService;
            _tvShowViewModel = tvShowViewModel;
            _busyProvider    = busyProvider;

            Title = new RequiredPropertyDecorator <string>(new StringCachedPropertyDecorator(keyDataStore, path + "?title"));
            Title.PropertyChanged         += CachedPropertyChanged;
            SeasonNumber                   = new RequiredPropertyDecorator <int?>(new IntCachedPropertyDecorator(keyDataStore, path + "?seasonNumber"));
            SeasonNumber.PropertyChanged  += CachedPropertyChanged;
            EpisodeNumber                  = new RequiredPropertyDecorator <int?>(new IntCachedPropertyDecorator(keyDataStore, path + "?episodeNumber"));
            EpisodeNumber.PropertyChanged += CachedPropertyChanged;
            Path = path;

            Credits   = new DashDelimitedCollectionViewModel <string>(s => s);
            Directors = new DashDelimitedCollectionViewModel <string>(s => s);
            ImagePath = viewModelFactory.GetImage(true);

            RefreshCommand = new RefreshMetadataCommand(this);
            UpdateCommand  = new UpdateMetadataCommand(this, progressManager, busyProvider);
            SaveCommand    = new SaveMetadataCommand(this);
            DeleteCommand  = new DeleteMetadataCommand(this);
        }
コード例 #2
0
 public TvShowSelectionViewModel(ITvShowMetadataService metadataService,
                                 ITvShowViewModel tvShowMetadata,
                                 IBusyProvider busyProvider)
     : base(busyProvider, tvShowMetadata.Title.OriginalValue)
 {
     _metadataService = metadataService;
     _tvShowMetadata  = tvShowMetadata;
 }
コード例 #3
0
 private void AddTvShows(IEnumerable <string> tvShows)
 {
     foreach (string path in tvShows)
     {
         ITvShowViewModel newTvShow = _viewModelFactory.GetTvShow(path);
         TvShows.Add(newTvShow);
     }
 }
コード例 #4
0
 private void RemoveTvShows(IEnumerable <string> tvShows)
 {
     foreach (string path in tvShows)
     {
         ITvShowViewModel tvShowToRemove = TvShows.First(show => show.Path == path);
         TvShows.Remove(tvShowToRemove);
     }
 }
コード例 #5
0
 public SeasonViewModelTests()
 {
     _viewModelFactory  = Substitute.For <ITvShowViewModelFactory>();
     _tvShowFileService = Substitute.For <ITvShowFileService>();
     _tvShowMetadata    = Substitute.For <ITvShowViewModel>();
     _busyProvider      = _busyProvider = Substitute.For <IBusyProvider>();
     _path      = @"C:\Folder\TV Shows\Game of Thrones\Season 1";
     _viewModel = new SeasonViewModel(_viewModelFactory, _tvShowFileService, _tvShowMetadata, null, _busyProvider, _path);
 }
コード例 #6
0
 public SeasonViewModelTests()
 {
     _viewModelFactory = Substitute.For<ITvShowViewModelFactory>();
     _tvShowFileService = Substitute.For<ITvShowFileService>();
     _tvShowMetadata = Substitute.For<ITvShowViewModel>();
     _busyProvider = _busyProvider = Substitute.For<IBusyProvider>();
     _path = @"C:\Folder\TV Shows\Game of Thrones\Season 1";
     _viewModel = new SeasonViewModel(_viewModelFactory, _tvShowFileService, _tvShowMetadata, null, _busyProvider, _path);
 }
コード例 #7
0
 public EpisodeViewModelTests()
 {
     _metadataService = Substitute.For<IEpisodeMetadataService>();
     _tvShowMetadata = Substitute.For<ITvShowViewModel>();
     ITvShowViewModelFactory viewModelFactory = Substitute.For<ITvShowViewModelFactory>();
     _busyProvider = _busyProvider = Substitute.For<IBusyProvider>();
     var keyDataStore = Substitute.For<IKeyDataStore>();
     _path = @"C:\Folder\TV Shows\Game of Thrones\Season 2\3x09.mkv";
     _viewModel = new EpisodeViewModel(viewModelFactory, _metadataService, _tvShowMetadata, null, _busyProvider, null, keyDataStore, _path);
 }
コード例 #8
0
        public EpisodeViewModelTests()
        {
            _metadataService = Substitute.For <IEpisodeMetadataService>();
            _tvShowMetadata  = Substitute.For <ITvShowViewModel>();
            ITvShowViewModelFactory viewModelFactory = Substitute.For <ITvShowViewModelFactory>();

            _busyProvider = _busyProvider = Substitute.For <IBusyProvider>();
            var keyDataStore = Substitute.For <IKeyDataStore>();

            _path      = @"C:\Folder\TV Shows\Game of Thrones\Season 2\3x09.mkv";
            _viewModel = new EpisodeViewModel(viewModelFactory, _metadataService, _tvShowMetadata, null, _busyProvider, null, keyDataStore, _path);
        }
コード例 #9
0
        public SeasonViewModel(ITvShowViewModelFactory viewModelFactory,
                               ITvShowFileService tvShowFileService,
                               ITvShowViewModel tvShowMetadata,
                               ITvShowMetadataService metadataService,
                               IBusyProvider busyProvider,
                               string path)
            : base(busyProvider, viewModelFactory.GetEpisode(tvShowMetadata, "dummy"))
        {
            _viewModelFactory  = viewModelFactory;
            _tvShowFileService = tvShowFileService;
            _tvShowMetadata    = tvShowMetadata;
            _busyProvider      = busyProvider;
            _path = path;

            _posterUrl = viewModelFactory.GetImage(true, new SeasonPosterImageStrategy(metadataService, tvShowMetadata.Path, path));
            _bannerUrl = viewModelFactory.GetImage(false, new SeasonBannerImageStrategy(metadataService, tvShowMetadata.Path, path));
        }
コード例 #10
0
        public TvShowImagesViewModel(ITvShowFileService tvShowFileService,
            ITvShowMetadataService metadataService,
            ITvShowViewModelFactory viewModelFactory,
            ITvShowViewModel metadataViewModel,
            IBusyProvider busyProvider,
            string path)
        {
            _tvShowFileService = tvShowFileService;
            _viewModelFactory = viewModelFactory;
            _busyProvider = busyProvider;
            _path = path;
            SeasonImages = new ObservableCollection<ISeasonImagesViewModel>();

            FanartUrl = viewModelFactory.GetImage(true, new FanartImageStrategy(metadataService, metadataViewModel));
            PosterUrl = viewModelFactory.GetImage(true, new PosterImageStrategy(metadataService, metadataViewModel));
            BannerUrl = viewModelFactory.GetImage(false, new BannerImageStrategy(metadataService, metadataViewModel));
        }
コード例 #11
0
        public TvShowImagesViewModel(ITvShowFileService tvShowFileService,
                                     ITvShowMetadataService metadataService,
                                     ITvShowViewModelFactory viewModelFactory,
                                     ITvShowViewModel metadataViewModel,
                                     IBusyProvider busyProvider,
                                     string path)
        {
            _tvShowFileService = tvShowFileService;
            _viewModelFactory  = viewModelFactory;
            _busyProvider      = busyProvider;
            _path        = path;
            SeasonImages = new ObservableCollection <ISeasonImagesViewModel>();

            FanartUrl = viewModelFactory.GetImage(true, new FanartImageStrategy(metadataService, metadataViewModel));
            PosterUrl = viewModelFactory.GetImage(true, new PosterImageStrategy(metadataService, metadataViewModel));
            BannerUrl = viewModelFactory.GetImage(false, new BannerImageStrategy(metadataService, metadataViewModel));
        }
コード例 #12
0
        public void Sources_RemovesSpecificFolder_RemovesTvShow()
        {
            // Arrange
            const string folder = @"C:\Folder\TV Shows\Game of Thrones";

            ITvShowViewModel tvShowViewModel = Substitute.For <ITvShowViewModel>();

            tvShowViewModel.Path.Returns(folder);
            _viewModelFactory.GetTvShow(folder)
            .Returns(tvShowViewModel);

            _sourceManagerViewModel.SpecificFolders.Add(folder);

            // Act
            _sourceManagerViewModel.SpecificFolders.Remove(folder);

            // Assert
            Assert.Empty(_viewModel.TvShows);
        }
コード例 #13
0
        public void Execute_WithTvShows_UpdatesTheseTvShows()
        {
            // Arrange
            ITvShowViewModel viewModel1 = Substitute.For <ITvShowViewModel>();

            _tvShows.Add(viewModel1);
            IEnumerable <ProgressItem> items = new List <ProgressItem> {
                CreateProgressItem()
            };

            viewModel1.FindNewEpisodes()
            .Returns(items.ToTask());

            // Act
            _command.Execute(null);

            // Assert
            _progressManager.Received()
            .AddItem(Arg.Any <ProgressItem>());
            _progressManager.Received()
            .Start().Async();
        }
コード例 #14
0
 public ISeasonViewModel GetSeason(ITvShowViewModel tvShowMetadata, string path)
 {
     return(new SeasonViewModel(this, _tvShowFileService, tvShowMetadata, _tvShowMetadataService, _busyProvider, path));
 }
コード例 #15
0
 public ITvShowImagesViewModel GetTvShowImages(ITvShowViewModel metadataViewModel, string path)
 {
     return new TvShowImagesViewModel(_tvShowFileService, _tvShowMetadataService, this, metadataViewModel, _busyProvider, path);
 }
コード例 #16
0
 public BannerImageStrategy(ITvShowMetadataService metadataService, ITvShowViewModel metadataViewModel)
 {
     _metadataService   = metadataService;
     _metadataViewModel = metadataViewModel;
 }
コード例 #17
0
 public FanartImageStrategy(ITvShowMetadataService metadataService, ITvShowViewModel metadataViewModel)
 {
     _metadataService = metadataService;
     _metadataViewModel = metadataViewModel;
 }
コード例 #18
0
 public ISeasonViewModel GetSeason(ITvShowViewModel tvShowMetadata, string path)
 {
     return new SeasonViewModel(this, _tvShowFileService, tvShowMetadata, _tvShowMetadataService, _busyProvider, path);
 }
コード例 #19
0
 public ITvShowSelectionViewModel GetTvShowSelection(ITvShowViewModel tvShowMetadata)
 {
     return(new TvShowSelectionViewModel(_tvShowMetadataService, tvShowMetadata, _busyProvider));
 }
コード例 #20
0
 public IEpisodeViewModel GetEpisode(ITvShowViewModel tvShowMetadata, string path)
 {
     return(new EpisodeViewModel(this, _episodeMetadataService, tvShowMetadata, _progressManagerViewModel, _busyProvider, _dialogViewer, _keyDataStore, path));
 }
コード例 #21
0
 public IEpisodeViewModel GetEpisode(ITvShowViewModel tvShowMetadata, string path)
 {
     return new EpisodeViewModel(this, _episodeMetadataService, tvShowMetadata, _progressManagerViewModel, _busyProvider, _dialogViewer, _keyDataStore, path);
 }
コード例 #22
0
 public ITvShowImagesViewModel GetTvShowImages(ITvShowViewModel metadataViewModel, string path)
 {
     return(new TvShowImagesViewModel(_tvShowFileService, _tvShowMetadataService, this, metadataViewModel, _busyProvider, path));
 }
コード例 #23
0
 public ITvShowSelectionViewModel GetTvShowSelection(ITvShowViewModel tvShowMetadata)
 {
     return new TvShowSelectionViewModel(_tvShowMetadataService, tvShowMetadata, _busyProvider);
 }