Esempio n. 1
0
 internal LocalPlaylist(string id, PlaylistRepository playlistRepository)
 {
     Id = id;
     _playlistRepository = playlistRepository;
     ItemsAddCommand     = new LocalPlaylistAddItemCommand(this);
     ItemsRemoveCommand  = new LocalPlaylistRemoveItemCommand(this);
 }
Esempio n. 2
0
 public VideoInfomationPageViewModel(
     ILoggerFactory loggerFactory,
     ApplicationLayoutManager applicationLayoutManager,
     AppearanceSettings appearanceSettings,
     VideoFilteringSettings ngSettings,
     NiconicoSession niconicoSession,
     LoginUserOwnedMylistManager userMylistManager,
     NicoVideoProvider nicoVideoProvider,
     LoginUserMylistProvider loginUserMylistProvider,
     SubscriptionManager subscriptionManager,
     NicoVideoSessionProvider nicoVideo,
     PageManager pageManager,
     Services.NotificationService notificationService,
     Services.DialogService dialogService,
     VideoPlayWithQueueCommand videoPlayWithQueueCommand,
     MylistAddItemCommand addMylistCommand,
     LocalPlaylistAddItemCommand localPlaylistAddItemCommand,
     AddSubscriptionCommand addSubscriptionCommand,
     OpenLinkCommand openLinkCommand,
     CopyToClipboardCommand copyToClipboardCommand,
     CopyToClipboardWithShareTextCommand copyToClipboardWithShareTextCommand,
     OpenShareUICommand openShareUICommand,
     CacheAddRequestCommand cacheAddRequestCommand,
     RecommendProvider recommendProvider,
     UserFollowProvider userFollowProvider,
     ChannelFollowProvider channelFollowProvider
     )
 {
     _logger = loggerFactory.CreateLogger <VideoInfomationPageViewModel>();
     ApplicationLayoutManager = applicationLayoutManager;
     AppearanceSettings       = appearanceSettings;
     NgSettings              = ngSettings;
     NiconicoSession         = niconicoSession;
     UserMylistManager       = userMylistManager;
     NicoVideoProvider       = nicoVideoProvider;
     LoginUserMylistProvider = loginUserMylistProvider;
     SubscriptionManager     = subscriptionManager;
     NicoVideo                           = nicoVideo;
     PageManager                         = pageManager;
     NotificationService                 = notificationService;
     DialogService                       = dialogService;
     VideoPlayWithQueueCommand           = videoPlayWithQueueCommand;
     AddMylistCommand                    = addMylistCommand;
     LocalPlaylistAddItemCommand         = localPlaylistAddItemCommand;
     AddSubscriptionCommand              = addSubscriptionCommand;
     OpenLinkCommand                     = openLinkCommand;
     CopyToClipboardCommand              = copyToClipboardCommand;
     CopyToClipboardWithShareTextCommand = copyToClipboardWithShareTextCommand;
     OpenShareUICommand                  = openShareUICommand;
     CacheAddRequestCommand              = cacheAddRequestCommand;
     _recommendProvider                  = recommendProvider;
     _userFollowProvider                 = userFollowProvider;
     _channelFollowProvider              = channelFollowProvider;
     NowLoading                          = new ReactiveProperty <bool>(false);
     IsLoadFailed                        = new ReactiveProperty <bool>(false);
 }
        public VideoItemsListView()
        {
            this.InitializeComponent();

            // Selection
            _selectionContext     = Microsoft.Toolkit.Mvvm.DependencyInjection.Ioc.Default.GetService <VideoItemsSelectionContext>();
            _niconicoSession      = Microsoft.Toolkit.Mvvm.DependencyInjection.Ioc.Default.GetService <NiconicoSession>();
            _localPlaylistManager = Microsoft.Toolkit.Mvvm.DependencyInjection.Ioc.Default.GetService <LocalMylistManager>();
            _mylistManager        = Microsoft.Toolkit.Mvvm.DependencyInjection.Ioc.Default.GetService <LoginUserOwnedMylistManager>();
            _queuePlaylist        = Microsoft.Toolkit.Mvvm.DependencyInjection.Ioc.Default.GetService <QueuePlaylist>();

            _addQueueCommand           = Microsoft.Toolkit.Mvvm.DependencyInjection.Ioc.Default.GetService <QueueAddItemCommand>();
            _removeQueueCommand        = Microsoft.Toolkit.Mvvm.DependencyInjection.Ioc.Default.GetService <QueueRemoveItemCommand>();
            _addMylistCommand          = Microsoft.Toolkit.Mvvm.DependencyInjection.Ioc.Default.GetService <MylistAddItemCommand>();
            _localMylistAddCommand     = new LocalPlaylistAddItemCommand();
            _removeWatchHistoryCommand = Microsoft.Toolkit.Mvvm.DependencyInjection.Ioc.Default.GetService <WatchHistoryRemoveItemCommand>();
            _copyMylistItemCommand     = Microsoft.Toolkit.Mvvm.DependencyInjection.Ioc.Default.GetService <MylistCopyItemCommand>();
            _moveMylistItemCommand     = Microsoft.Toolkit.Mvvm.DependencyInjection.Ioc.Default.GetService <MylistMoveItemCommand>();

            Loaded   += VideoItemsListView_Loaded;
            Unloaded += VideoItemsListView_Unloaded;
        }
        public VideoPlayerPageViewModel(
            ILoggerFactory loggerFactory,
            IScheduler scheduler,
            IPlayerView playerView,
            NiconicoSession niconicoSession,
            SubscriptionManager subscriptionManager,
            NicoVideoProvider nicoVideoProvider,
            ChannelProvider channelProvider,
            MylistProvider mylistProvider,
            AppearanceSettings appearanceSettings,
            PlayerSettings playerSettings,
            VideoCacheSettings_Legacy cacheSettings,
            ApplicationLayoutManager applicationLayoutManager,
            LocalMylistManager localMylistManager,
            LoginUserOwnedMylistManager userMylistManager,
            PageManager pageManager,
            QueuePlaylist queuePlaylist,
            HohoemaPlaylistPlayer hohoemaPlaylistPlayer,
            MediaPlayer mediaPlayer,
            VideoTogglePlayPauseCommand videoTogglePlayPauseCommand,
            NotificationService notificationService,
            DialogService dialogService,
            AddSubscriptionCommand addSubscriptionCommand,
            LocalPlaylistCreateCommand createLocalMylistCommand,
            MylistAddItemCommand addMylistCommand,
            LocalPlaylistAddItemCommand localPlaylistAddItemCommand,
            MylistCreateCommand createMylistCommand,
            VideoStreamingOriginOrchestrator videoStreamingOriginOrchestrator,
            VideoCommentPlayer commentPlayer,
            CommentCommandEditerViewModel commentCommandEditerViewModel,
            KeepActiveDisplayWhenPlaying keepActiveDisplayWhenPlaying,
            ObservableMediaPlayer observableMediaPlayer,
            VideoEndedRecommendation videoEndedRecommendation,
            PrimaryViewPlayerManager primaryViewPlayerManager,
            TogglePlayerDisplayViewCommand togglePlayerDisplayViewCommand,
            ShowPrimaryViewCommand showPrimaryViewCommand,
            MediaPlayerSoundVolumeManager soundVolumeManager,
            OpenLinkCommand openLinkCommand,
            CopyToClipboardCommand copyToClipboardCommand,
            ChangeVideoQualityCommand changeVideoQualityCommand,
            CopyToClipboardWithShareTextCommand copyToClipboardWithShareTextCommand,
            OpenShareUICommand openShareUICommand,
            PlaylistSidePaneContentViewModel playlistSidePaneContentViewModel,
            SettingsSidePaneContentViewModel settingsSidePaneContentViewModel,
            VideoCommentSidePaneContentViewModel videoCommentSidePaneContent,
            RelatedVideosSidePaneContentViewModel relatedVideosSidePaneContentViewModel
            )
        {
            _logger = loggerFactory.CreateLogger <VideoPlayerPageViewModel>();
            CurrentPlayerDisplayView = appearanceSettings
                                       .ObserveProperty(x => x.PlayerDisplayView)
                                       .ToReadOnlyReactivePropertySlim()
                                       .AddTo(_CompositeDisposable);

            _scheduler                             = scheduler;
            PlayerView                             = playerView;
            NiconicoSession                        = niconicoSession;
            SubscriptionManager                    = subscriptionManager;
            NicoVideoProvider                      = nicoVideoProvider;
            ChannelProvider                        = channelProvider;
            MylistProvider                         = mylistProvider;
            PlayerSettings                         = playerSettings;
            CacheSettings                          = cacheSettings;
            ApplicationLayoutManager               = applicationLayoutManager;
            LocalMylistManager                     = localMylistManager;
            UserMylistManager                      = userMylistManager;
            PageManager                            = pageManager;
            _queuePlaylist                         = queuePlaylist;
            _hohoemaPlaylistPlayer                 = hohoemaPlaylistPlayer;
            _NotificationService                   = notificationService;
            _HohoemaDialogService                  = dialogService;
            AddSubscriptionCommand                 = addSubscriptionCommand;
            CreateLocalMylistCommand               = createLocalMylistCommand;
            AddMylistCommand                       = addMylistCommand;
            LocalPlaylistAddItemCommand            = localPlaylistAddItemCommand;
            CreateMylistCommand                    = createMylistCommand;
            _videoStreamingOriginOrchestrator      = videoStreamingOriginOrchestrator;
            CommentPlayer                          = commentPlayer;
            CommentCommandEditerViewModel          = commentCommandEditerViewModel;
            PrimaryViewPlayerManager               = primaryViewPlayerManager;
            TogglePlayerDisplayViewCommand         = togglePlayerDisplayViewCommand;
            ShowPrimaryViewCommand                 = showPrimaryViewCommand;
            SoundVolumeManager                     = soundVolumeManager;
            OpenLinkCommand                        = openLinkCommand;
            CopyToClipboardCommand                 = copyToClipboardCommand;
            ChangeVideoQualityCommand              = changeVideoQualityCommand;
            CopyToClipboardWithShareTextCommand    = copyToClipboardWithShareTextCommand;
            OpenShareUICommand                     = openShareUICommand;
            _playlistSidePaneContentViewModel      = playlistSidePaneContentViewModel;
            _settingsSidePaneContentViewModel      = settingsSidePaneContentViewModel;
            _videoCommentSidePaneContentViewModel  = videoCommentSidePaneContent;
            _relatedVideosSidePaneContentViewModel = relatedVideosSidePaneContentViewModel;
            ObservableMediaPlayer                  = observableMediaPlayer
                                                     .AddTo(_CompositeDisposable);
            VideoEndedRecommendation = videoEndedRecommendation
                                       .AddTo(_CompositeDisposable);
            _keepActiveDisplayWhenPlaying = keepActiveDisplayWhenPlaying
                                            .AddTo(_CompositeDisposable);
            MediaPlayer = mediaPlayer;
            VideoTogglePlayPauseCommand = videoTogglePlayPauseCommand;
            SeekCommand            = new MediaPlayerSeekCommand(MediaPlayer);
            SetPlaybackRateCommand = new MediaPlayerSetPlaybackRateCommand(MediaPlayer);
            ToggleMuteCommand      = new MediaPlayerToggleMuteCommand(MediaPlayer);
            VolumeUpCommand        = new MediaPlayerVolumeUpCommand(SoundVolumeManager);
            VolumeDownCommand      = new MediaPlayerVolumeDownCommand(SoundVolumeManager);

            PlayNextCommand = _hohoemaPlaylistPlayer.GetCanGoNextOrPreviewObservable()
                              .SelectMany(async x => await _hohoemaPlaylistPlayer.CanGoNextAsync())
                              .ToAsyncReactiveCommand()
                              .AddTo(_CompositeDisposable);

            PlayNextCommand.Subscribe(async() => await _hohoemaPlaylistPlayer.GoNextAsync(NavigationCancellationToken))
            .AddTo(_CompositeDisposable);

            PlayPreviousCommand = _hohoemaPlaylistPlayer.GetCanGoNextOrPreviewObservable()
                                  .SelectMany(async x => await _hohoemaPlaylistPlayer.CanGoPreviewAsync())
                                  .ToAsyncReactiveCommand()
                                  .AddTo(_CompositeDisposable);

            PlayPreviousCommand.Subscribe(async() => await _hohoemaPlaylistPlayer.GoPreviewAsync(NavigationCancellationToken))
            .AddTo(_CompositeDisposable);

            IsLoopingEnabled = PlayerSettings.ToReactivePropertyAsSynchronized(x => x.IsCurrentVideoLoopingEnabled, raiseEventScheduler: scheduler)
                               .AddTo(_CompositeDisposable);
            IsLoopingEnabled.Subscribe(x => mediaPlayer.IsLoopingEnabled = x)
            .AddTo(_CompositeDisposable);

            IsPlaylistShuffleRequeted = PlayerSettings.ToReactivePropertyAsSynchronized(x => x.IsShuffleEnable, _scheduler)
                                        .AddTo(_CompositeDisposable);

            IsAvailablePlaylistRepeatOrShuffle = _hohoemaPlaylistPlayer.ObserveProperty(x => x.IsShuffleAndRepeatAvailable)
                                                 .ToReadOnlyReactiveProperty();
        }