Esempio n. 1
0
        public LocalPlaylistPageViewModel(
            ILoggerFactory loggerFactory,
            IMessenger messenger,
            ApplicationLayoutManager applicationLayoutManager,
            PageManager pageManager,
            LocalMylistManager localMylistManager,
            NicoVideoProvider nicoVideoProvider,
            VideoPlayWithQueueCommand videoPlayWithQueueCommand,
            PlaylistPlayAllCommand playlistPlayAllCommand,
            LocalPlaylistDeleteCommand localPlaylistDeleteCommand,
            SelectionModeToggleCommand selectionModeToggleCommand
            )
            : base(loggerFactory.CreateLogger <LocalPlaylistPageViewModel>())
        {
            ApplicationLayoutManager   = applicationLayoutManager;
            _pageManager               = pageManager;
            _localMylistManager        = localMylistManager;
            _nicoVideoProvider         = nicoVideoProvider;
            LocalPlaylistDeleteCommand = localPlaylistDeleteCommand;
            VideoPlayWithQueueCommand  = videoPlayWithQueueCommand;
            PlaylistPlayAllCommand     = playlistPlayAllCommand;
            SelectionModeToggleCommand = selectionModeToggleCommand;
            _messenger = messenger;

            CurrentPlaylistToken = Observable.CombineLatest(
                this.ObserveProperty(x => x.Playlist),
                this.ObserveProperty(x => x.SelectedSortOptionItem),
                (x, y) => new PlaylistToken(x, y)
                )
                                   .ToReadOnlyReactivePropertySlim()
                                   .AddTo(_CompositeDisposable);
        }
        public LocalPlaylistManagePageViewModel(
            PageManager pageManager,
            Services.DialogService dialogService,
            ApplicationLayoutManager applicationLayoutManager,
            LocalMylistManager localMylistManager,
            PlaylistPlayAllCommand playlistPlayAllCommand,
            LocalPlaylistCreateCommand localPlaylistCreateCommand,
            LocalPlaylistDeleteCommand localPlaylistDeleteCommand
            )
        {
            _pageManager               = pageManager;
            ApplicationLayoutManager   = applicationLayoutManager;
            _localMylistManager        = localMylistManager;
            PlaylistPlayAllCommand     = playlistPlayAllCommand;
            CreateLocalMylistCommand   = localPlaylistCreateCommand;
            DeleteLocalPlaylistCommand = localPlaylistDeleteCommand;
            ItemsView = new AdvancedCollectionView(_localMylistManager.LocalPlaylists);

            OpenMylistCommand = new ReactiveCommand <IPlaylist>()
                                .AddTo(_CompositeDisposable);

            OpenMylistCommand.Subscribe(listItem =>
            {
                _pageManager.OpenPageWithId(HohoemaPageType.LocalPlaylist, listItem.PlaylistId.Id);
            });


            RenameLocalPlaylistCommand = new RelayCommand <LocalPlaylist>(async playlist =>
            {
                var result = await dialogService.GetTextAsync(
                    "RenameLocalPlaylist",
                    "RenameLocalPlaylist_Placeholder",
                    playlist.Name,
                    name => !string.IsNullOrWhiteSpace(name)
                    );

                if (result is not null)
                {
                    playlist.Name = result;
                }
            });
        }
 public LocalPlaylistPageViewModel(
     ApplicationLayoutManager applicationLayoutManager,
     PageManager pageManager,
     LocalMylistManager localMylistManager,
     HohoemaPlaylist hohoemaPlaylist,
     PlaylistAggregateGetter playlistAggregate,
     LocalPlaylistDeleteCommand localPlaylistDeleteCommand,
     PlaylistPlayAllCommand playlistPlayAllCommand,
     RemoveWatchedItemsInAfterWatchPlaylistCommand removeWatchedItemsInAfterWatchPlaylistCommand
     )
 {
     ApplicationLayoutManager = applicationLayoutManager;
     _pageManager = pageManager;
     _localMylistManager = localMylistManager;
     HohoemaPlaylist = hohoemaPlaylist;
     _playlistAggregate = playlistAggregate;
     LocalPlaylistDeleteCommand = localPlaylistDeleteCommand;
     PlaylistPlayAllCommand = playlistPlayAllCommand;
     RemoveWatchedItemsInAfterWatchPlaylistCommand = removeWatchedItemsInAfterWatchPlaylistCommand;
 }