public ApplicationLayoutManager(AppearanceSettings appearanceSettings)
        {
            _appearanceSettings = appearanceSettings;

            new[]
            {
                _appearanceSettings.ObserveProperty(x => x.OverrideInteractionMode).ToUnit(),
                Observable.FromEventPattern <WindowSizeChangedEventHandler, WindowSizeChangedEventArgs>(
                    h => Window.Current.SizeChanged += h,
                    h => Window.Current.SizeChanged -= h
                    ).ToUnit()
            }
            .Merge()
            .Subscribe(_ => RefreshAppLayout());
        }
Exemple #2
0
        public SettingsPageViewModel(
            PageManager pageManager,
            NotificationService toastService,
            Services.DialogService dialogService,
            PlayerSettings playerSettings,
            VideoRankingSettings rankingSettings,
            NicoRepoSettings nicoRepoSettings,
            AppearanceSettings appearanceSettings,
            VideoCacheSettings cacheSettings,
            VideoCacheFolderManager videoCacheFolderManager,
            ApplicationLayoutManager applicationLayoutManager,
            VideoFilteringSettings videoFilteringRepository,
            BackupManager backupManager,
            ILoggerFactory loggerFactory
            )
        {
            _notificationService      = toastService;
            RankingSettings           = rankingSettings;
            _HohoemaDialogService     = dialogService;
            PlayerSettings            = playerSettings;
            ActivityFeedSettings      = nicoRepoSettings;
            AppearanceSettings        = appearanceSettings;
            VideoCacheSettings        = cacheSettings;
            _videoCacheFolderManager  = videoCacheFolderManager;
            ApplicationLayoutManager  = applicationLayoutManager;
            _videoFilteringRepository = videoFilteringRepository;
            _backupManager            = backupManager;
            _logger = loggerFactory.CreateLogger <SettingsPageViewModel>();

            // NG Video Owner User Id
            NGVideoOwnerUserIdEnable = _videoFilteringRepository.ToReactivePropertyAsSynchronized(x => x.NGVideoOwnerUserIdEnable)
                                       .AddTo(_CompositeDisposable);
            NGVideoOwnerUserIds = _videoFilteringRepository.GetVideoOwnerIdFilteringEntries();

            OpenUserPageCommand = new RelayCommand <VideoOwnerIdFilteringEntry>(userIdInfo =>
            {
                pageManager.OpenPageWithId(HohoemaPageType.UserInfo, userIdInfo.UserId);
            });

            // NG Keyword on Video Title
            VideoTitleFilteringItems = new ObservableCollection <VideoFilteringTitleViewModel>();

            NGVideoTitleKeywordEnable = _videoFilteringRepository.ToReactivePropertyAsSynchronized(x => x.NGVideoTitleKeywordEnable)
                                        .AddTo(_CompositeDisposable);

            TestText = _videoFilteringRepository.ToReactivePropertyAsSynchronized(x => x.NGVideoTitleTestText)
                       .AddTo(_CompositeDisposable);

            /*
             * NGVideoTitleKeywordError = NGVideoTitleKeywords
             *  .Select(x =>
             *  {
             *      if (x == null) { return null; }
             *
             *      var keywords = x.Split('\r');
             *      var invalidRegex = keywords.FirstOrDefault(keyword =>
             *      {
             *          Regex regex = null;
             *          try
             *          {
             *              regex = new Regex(keyword);
             *          }
             *          catch { }
             *          return regex == null;
             *      });
             *
             *      if (invalidRegex == null)
             *      {
             *          return null;
             *      }
             *      else
             *      {
             *          return $"Error in \"{invalidRegex}\"";
             *      }
             *  })
             *  .ToReadOnlyReactiveProperty()
             *  .AddTo(_CompositeDisposable);
             */
            // アピアランス

            StartupPageType = AppearanceSettings.ToReactivePropertyAsSynchronized(x => x.FirstAppearPageType)
                              .AddTo(_CompositeDisposable);

            var currentTheme = App.GetTheme();

            SelectedTheme = new ReactiveProperty <ElementTheme>(AppearanceSettings.ApplicationTheme, mode: ReactivePropertyMode.DistinctUntilChanged)
                            .AddTo(_CompositeDisposable);

            SelectedTheme.Subscribe(theme =>
            {
                AppearanceSettings.ApplicationTheme = theme;

                ApplicationTheme appTheme;
                if (theme == ElementTheme.Default)
                {
                    appTheme = Views.Helpers.SystemThemeHelper.GetSystemTheme();
                }
                else if (theme == ElementTheme.Dark)
                {
                    appTheme = ApplicationTheme.Dark;
                }
                else
                {
                    appTheme = ApplicationTheme.Light;
                }

                App.SetTheme(appTheme);

                var appView = ApplicationView.GetForCurrentView();
                if (appTheme == ApplicationTheme.Light)
                {
                    appView.TitleBar.ButtonForegroundColor         = Colors.Black;
                    appView.TitleBar.ButtonHoverBackgroundColor    = Colors.DarkGray;
                    appView.TitleBar.ButtonHoverForegroundColor    = Colors.Black;
                    appView.TitleBar.ButtonInactiveForegroundColor = Colors.Gray;
                }
                else
                {
                    appView.TitleBar.ButtonForegroundColor         = Colors.White;
                    appView.TitleBar.ButtonHoverBackgroundColor    = Colors.DimGray;
                    appView.TitleBar.ButtonHoverForegroundColor    = Colors.White;
                    appView.TitleBar.ButtonInactiveForegroundColor = Colors.DarkGray;
                }
            })
            .AddTo(_CompositeDisposable);



            IsDefaultFullScreen = new ReactiveProperty <bool>(ApplicationView.PreferredLaunchWindowingMode == ApplicationViewWindowingMode.FullScreen)
                                  .AddTo(_CompositeDisposable);
            IsDefaultFullScreen.Subscribe(x =>
            {
                if (x)
                {
                    ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
                }
                else
                {
                    ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;
                }
            })
            .AddTo(_CompositeDisposable);

            AppearanceSettings.ObserveProperty(x => x.Locale, isPushCurrentValueAtFirst: false).Subscribe(locale =>
            {
                I18NPortable.I18N.Current.Locale = locale;
            })
            .AddTo(_CompositeDisposable);

            // キャッシュ
            DefaultCacheQuality = VideoCacheSettings.ToReactivePropertyAsSynchronized(x => x.DefaultCacheQuality)
                                  .AddTo(_CompositeDisposable);
            IsAllowDownloadOnMeteredNetwork = VideoCacheSettings.ToReactivePropertyAsSynchronized(x => x.IsAllowDownloadOnMeteredNetwork)
                                              .AddTo(_CompositeDisposable);
            MaxVideoCacheStorageSize = VideoCacheSettings.ToReactivePropertyAsSynchronized(x => x.MaxVideoCacheStorageSize)
                                       .AddTo(_CompositeDisposable);
            OpenCurrentCacheFolderCommand = new RelayCommand(async() =>
            {
                var folder = _videoCacheFolderManager.VideoCacheFolder;
                if (folder != null)
                {
                    await Windows.System.Launcher.LaunchFolderAsync(folder);
                }
            });

            // シェア
            IsLoginTwitter = new ReactiveProperty <bool>(/*TwitterHelper.IsLoggedIn*/ false)
                             .AddTo(_CompositeDisposable);
            TwitterAccountScreenName = new ReactiveProperty <string>(/*TwitterHelper.TwitterUser?.ScreenName ?? ""*/)
                                       .AddTo(_CompositeDisposable);


            StringBuilder sb = new StringBuilder();

            sb.Append(SystemInformation.Instance.ApplicationName)
            .Append(" v").Append(SystemInformation.Instance.ApplicationVersion.ToFormattedString())
            .AppendLine();
            sb.Append(SystemInformation.Instance.OperatingSystem).Append(" ").Append(SystemInformation.Instance.OperatingSystemArchitecture)
            .Append("(").Append(SystemInformation.Instance.OperatingSystemVersion).Append(")")
            .Append(" ").Append(DeviceInfo.Idiom)
            ;
            VersionText = sb.ToString();

            IsDebugModeEnabled = new ReactiveProperty <bool>((App.Current as App).IsDebugModeEnabled, mode: ReactivePropertyMode.DistinctUntilChanged)
                                 .AddTo(_CompositeDisposable);
            IsDebugModeEnabled.Subscribe(isEnabled =>
            {
                (App.Current as App).IsDebugModeEnabled = isEnabled;
            })
            .AddTo(_CompositeDisposable);
        }
        public MenuNavigatePageBaseViewModel(
            IUnityContainer container,
            IScheduler scheduler,
            INavigationService navigationService,
            AppearanceSettings appearanceSettings,
            PinSettings pinSettings,
            NiconicoSession niconicoSession,
            LocalMylistManager localMylistManager,
            UserMylistManager userMylistManager,
            VideoCacheManager videoCacheManager,
            PageManager pageManager,
            PlayerViewManager playerViewManager,
            Services.NiconicoLoginService niconicoLoginService,
            Commands.LogoutFromNiconicoCommand logoutFromNiconicoCommand
            )
        {
            PageManager               = pageManager;
            PlayerViewManager         = playerViewManager;
            NiconicoLoginService      = niconicoLoginService;
            LogoutFromNiconicoCommand = logoutFromNiconicoCommand;
            Container          = container;
            Scheduler          = scheduler;
            NavigationService  = navigationService;
            AppearanceSettings = appearanceSettings;
            PinSettings        = pinSettings;
            NiconicoSession    = niconicoSession;
            LocalMylistManager = localMylistManager;
            UserMylistManager  = userMylistManager;
            VideoCacheManager  = videoCacheManager;

            NiconicoSession.LogIn  += (sender, e) => ResetMenuItems();
            NiconicoSession.LogOut += (sender, e) => ResetMenuItems();

            CurrentMenuType = new ReactiveProperty <MenuItemBase>();
            VideoMenu       = App.Current.Container.Resolve <VideoMenuSubPageContent>();
            LiveMenu        = App.Current.Container.Resolve <LiveMenuSubPageContent>();

            // TV Mode
            if (Services.Helpers.DeviceTypeHelper.IsXbox)
            {
                IsTVModeEnable = new ReactiveProperty <bool>(true);
            }
            else
            {
                IsTVModeEnable = AppearanceSettings.ObserveProperty(x => x.IsForceTVModeEnable)
                                 .ToReactiveProperty();
            }


            ServiceLevel = NiconicoSession.ObserveProperty(x => x.ServiceStatus)
                           .ToReadOnlyReactiveProperty(eventScheduler: Scheduler);

            IsNeedFullScreenToggleHelp
                = ApplicationView.PreferredLaunchWindowingMode == ApplicationViewWindowingMode.FullScreen;

            IsOpenPane = new ReactiveProperty <bool>(false);

            MainSelectedItem = new ReactiveProperty <HohoemaListingPageItemBase>(null, ReactivePropertyMode.DistinctUntilChanged);


            PinItems = new ObservableCollection <PinItemViewModel>(
                PinSettings.Pins.Select(x => Container.Resolve <PinItemViewModel>(new ParameterOverride("pin", x)))
                );


            bool isPinItemsChanging = false;

            PinSettings.Pins.CollectionChangedAsObservable()
            .Subscribe(args =>
            {
                if (isPinItemsChanging)
                {
                    return;
                }

                if (args.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
                {
                    foreach (var item in args.NewItems)
                    {
                        PinItems.Add(Container.Resolve <PinItemViewModel>(new ParameterOverride("pin", item as HohoemaPin)));
                    }
                    RaisePropertyChanged(nameof(PinItems));
                }
                else if (args.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
                {
                    foreach (var item in args.OldItems)
                    {
                        var removedPin = item as HohoemaPin;
                        var pinVM      = PinItems.FirstOrDefault(x => x.Pin == removedPin);
                        if (pinVM != null)
                        {
                            PinItems.Remove(pinVM);
                        }
                    }
                    RaisePropertyChanged(nameof(PinItems));
                }
            });

            ResetMenuItems();

            // TODO; PinSettings側で自動保存するようにしたい
            PinItems.CollectionChangedAsObservable()
            .Subscribe(async _ =>
            {
                await Task.Delay(50);

                try
                {
                    isPinItemsChanging = true;
                    PinSettings.Pins.Clear();
                    foreach (var pin in PinItems)
                    {
                        PinSettings.Pins.Add(pin.Pin);
                    }
                }
                finally
                {
                    isPinItemsChanging = false;
                }
            });

            /*
             * Observable.Merge(
             *  MainSelectedItem,
             *  SubSelectedItem
             *  )
             *  .Where(x => x != null)
             *  .Subscribe(x => x.SelectedAction(x.Source));
             */
            /*
             * PageManager.ObserveProperty(x => x.CurrentPageType)
             *  .Subscribe(pageType =>
             *  {
             *      //                    IsOpenPane.Value = false;
             *
             *      bool isMenuItemOpened = false;
             *      foreach (var item in MenuItems)
             *      {
             *          if ((item as MenuItemViewModel)?.PageType == pageType)
             *          {
             *              MainSelectedItem.Value = item;
             *              isMenuItemOpened = true;
             *              break;
             *          }
             *      }
             *
             *
             *      if (!isMenuItemOpened)
             *      {
             *          MainSelectedItem.Value = null;
             *      }
             *
             *      if (Services.Helpers.DeviceTypeHelper.IsXbox || AppearanceSettings.IsForceTVModeEnable
             || Services.Helpers.DeviceTypeHelper.IsMobile
             ||     )
             ||     {
             ||         IsOpenPane.Value = false;
             ||     }
             || });
             */


            PageManager.ObserveProperty(x => x.PageTitle)
            .Subscribe(x =>
            {
                TitleText = x;
            });

            CanGoBackNavigation = new ReactiveProperty <bool>();

            (NavigationService as IPlatformNavigationService).CanGoBackChanged += (_, e) =>
            {
                CanGoBackNavigation.Value = NavigationService.CanGoBack();
            };

            /*
             * IsVisibleMenu = PageManager.ObserveProperty(x => x.CurrentPageType)
             *  .Select(x =>
             *  {
             *      return !PageManager.IsHiddenMenuPage(x);
             *  })
             *  .ToReactiveProperty(false);
             */

            NowNavigating = PageManager.ObserveProperty(x => x.PageNavigating)
                            .ToReactiveProperty();


            PageManager.StartWork    += PageManager_StartWork;
            PageManager.ProgressWork += PageManager_ProgressWork;
            PageManager.CompleteWork += PageManager_CompleteWork;
            PageManager.CancelWork   += PageManager_CancelWork;

            UserName = NiconicoSession.ObserveProperty(x => x.UserName)
                       .ToReadOnlyReactiveProperty(eventScheduler: Scheduler);

            UserIconUrl = NiconicoSession.ObserveProperty(x => x.UserIconUrl)
                          .ToReadOnlyReactiveProperty(eventScheduler: Scheduler);


            // 検索
            SearchKeyword = new ReactiveProperty <string>("");

            SearchCommand = new ReactiveCommand();
            SearchCommand
            .Subscribe(async _ =>
            {
                await Task.Delay(50);
                var keyword = SearchKeyword.Value;

                if (string.IsNullOrWhiteSpace(keyword))
                {
                    return;
                }

                SearchTarget?searchType = CurrentMenuType.Value is LiveMenuSubPageContent ? SearchTarget.Niconama : SearchTarget.Keyword;
                var searched            = Database.SearchHistoryDb.LastSearchedTarget(keyword);
                if (searched != null)
                {
                    searchType = searched;
                }

                PageManager.Search(searchType.Value, keyword);

                ResetSearchHistoryItems();
            });

            SearchSuggestionWords = new ObservableCollection <string>();



            // InAppNotification
            IsShowInAppNotification = new ReactiveProperty <bool>(true);


            // 検索履歴アイテムを初期化
            ResetSearchHistoryItems();
        }
        public SettingsPageViewModel(
            PageManager pageManager,
            NotificationService toastService,
            Services.DialogService dialogService,
            PlayerSettings playerSettings,
            NGSettings ngSettings,
            RankingSettings rankingSettings,
            ActivityFeedSettings activityFeedSettings,
            AppearanceSettings appearanceSettings,
            CacheSettings cacheSettings,
            ApplicationLayoutManager applicationLayoutManager
            )
        {
            ToastNotificationService = toastService;
            NgSettings               = ngSettings;
            RankingSettings          = rankingSettings;
            _HohoemaDialogService    = dialogService;
            PlayerSettings           = playerSettings;
            NgSettings               = ngSettings;
            RankingSettings          = rankingSettings;
            ActivityFeedSettings     = activityFeedSettings;
            AppearanceSettings       = appearanceSettings;
            CacheSettings            = cacheSettings;
            ApplicationLayoutManager = applicationLayoutManager;

            // NG Video Owner User Id
            NGVideoOwnerUserIdEnable = NgSettings.ToReactivePropertyAsSynchronized(x => x.NGVideoOwnerUserIdEnable);
            NGVideoOwnerUserIds      = NgSettings.NGVideoOwnerUserIds
                                       .ToReadOnlyReactiveCollection();

            OpenUserPageCommand = new DelegateCommand <UserIdInfo>(userIdInfo =>
            {
                pageManager.OpenPageWithId(HohoemaPageType.UserInfo, userIdInfo.UserId);
            });

            // NG Keyword on Video Title
            NGVideoTitleKeywordEnable = NgSettings.ToReactivePropertyAsSynchronized(x => x.NGVideoTitleKeywordEnable);
            NGVideoTitleKeywords      = new ReactiveProperty <string>();
            NGVideoTitleKeywordError  = NGVideoTitleKeywords
                                        .Select(x =>
            {
                if (x == null)
                {
                    return(null);
                }

                var keywords     = x.Split('\r');
                var invalidRegex = keywords.FirstOrDefault(keyword =>
                {
                    Regex regex = null;
                    try
                    {
                        regex = new Regex(keyword);
                    }
                    catch { }
                    return(regex == null);
                });

                if (invalidRegex == null)
                {
                    return(null);
                }
                else
                {
                    return($"Error in \"{invalidRegex}\"");
                }
            })
                                        .ToReadOnlyReactiveProperty();

            // アピアランス

            var currentTheme = App.GetTheme();

            SelectedTheme = new ReactiveProperty <ElementTheme>(AppearanceSettings.Theme, mode: ReactivePropertyMode.DistinctUntilChanged);

            SelectedTheme.Subscribe(theme =>
            {
                AppearanceSettings.Theme = theme;

                ApplicationTheme appTheme;
                if (theme == ElementTheme.Default)
                {
                    appTheme = Views.Helpers.SystemThemeHelper.GetSystemTheme();
                }
                else if (theme == ElementTheme.Dark)
                {
                    appTheme = ApplicationTheme.Dark;
                }
                else
                {
                    appTheme = ApplicationTheme.Light;
                }

                App.SetTheme(appTheme);

                var appView = ApplicationView.GetForCurrentView();
                if (appTheme == ApplicationTheme.Light)
                {
                    appView.TitleBar.ButtonForegroundColor         = Colors.Black;
                    appView.TitleBar.ButtonHoverBackgroundColor    = Colors.DarkGray;
                    appView.TitleBar.ButtonHoverForegroundColor    = Colors.Black;
                    appView.TitleBar.ButtonInactiveForegroundColor = Colors.Gray;
                }
                else
                {
                    appView.TitleBar.ButtonForegroundColor         = Colors.White;
                    appView.TitleBar.ButtonHoverBackgroundColor    = Colors.DimGray;
                    appView.TitleBar.ButtonHoverForegroundColor    = Colors.White;
                    appView.TitleBar.ButtonInactiveForegroundColor = Colors.DarkGray;
                }
            });



            IsDefaultFullScreen = new ReactiveProperty <bool>(ApplicationView.PreferredLaunchWindowingMode == ApplicationViewWindowingMode.FullScreen);
            IsDefaultFullScreen.Subscribe(x =>
            {
                if (x)
                {
                    ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
                }
                else
                {
                    ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;
                }
            });

            StartupPageType = AppearanceSettings
                              .ToReactivePropertyAsSynchronized(x => x.StartupPageType);

            AppearanceSettings.ObserveProperty(x => x.Locale, isPushCurrentValueAtFirst: false).Subscribe(locale =>
            {
                I18NPortable.I18N.Current.Locale = locale;
            });

            // キャッシュ
            DefaultCacheQuality                 = CacheSettings.ToReactivePropertyAsSynchronized(x => x.DefaultCacheQuality);
            IsAllowDownloadOnMeteredNetwork     = CacheSettings.ToReactivePropertyAsSynchronized(x => x.IsAllowDownloadOnMeteredNetwork);
            DefaultCacheQualityOnMeteredNetwork = CacheSettings.ToReactivePropertyAsSynchronized(x => x.DefaultCacheQualityOnMeteredNetwork);

            // シェア
            IsLoginTwitter           = new ReactiveProperty <bool>(/*TwitterHelper.IsLoggedIn*/ false);
            TwitterAccountScreenName = new ReactiveProperty <string>(/*TwitterHelper.TwitterUser?.ScreenName ?? ""*/);


            // アバウト
            var version = Windows.ApplicationModel.Package.Current.Id.Version;

#if DEBUG
            VersionText = $"{version.Major}.{version.Minor}.{version.Build} DEBUG";
#else
            VersionText = $"{version.Major}.{version.Minor}.{version.Build}";
#endif


            var dispatcher = Window.Current.CoreWindow.Dispatcher;
            LisenceSummary.Load()
            .ContinueWith(async prevResult =>
            {
                await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    var lisenceSummary = prevResult.Result;

                    LisenceItems = lisenceSummary.Items
                                   .OrderBy(x => x.Name)
                                   .Select(x => new LisenceItemViewModel(x))
                                   .ToList();
                    RaisePropertyChanged(nameof(LisenceItems));
                });
            });


            IsDebugModeEnabled = new ReactiveProperty <bool>((App.Current as App).IsDebugModeEnabled, mode: ReactivePropertyMode.DistinctUntilChanged);
            IsDebugModeEnabled.Subscribe(isEnabled =>
            {
                (App.Current as App).IsDebugModeEnabled = isEnabled;
            })
            .AddTo(_CompositeDisposable);
        }
        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();
        }