public MylistPlaylistFactory(LoginUserOwnedMylistManager loginUserOwnedMylistManager,
                              MylistResolver mylistResolver
                              )
 {
     _loginUserOwnedMylistManager = loginUserOwnedMylistManager;
     _mylistResolver = mylistResolver;
 }
        public VideoMenuSubPageContent(
            NiconicoSession niconicoSession,
            LocalMylistManager localMylistManager,
            LoginUserOwnedMylistManager mylistManager,
            PageManager pageManager
            )
        {
            NiconicoSession    = niconicoSession;
            LocalMylistManager = localMylistManager;
            MylistManager      = mylistManager;
            PageManager        = pageManager;
            MenuItems          = new ObservableCollection <HohoemaListingPageItemBase>();

            ResetMenuItems();

            LocalMylists = LocalMylistManager.LocalPlaylists
                           .ToReadOnlyReactiveCollection(x =>
                                                         new MenuItemViewModel(x.Name, HohoemaPageType.LocalPlaylist, new NavigationParameters {
                { "id", x.PlaylistId.Id }
            }) as HohoemaListingPageItemBase
                                                         )
                           .AddTo(_CompositeDisposable);
            Mylists = MylistManager.Mylists
                      .ToReadOnlyReactiveCollection(x =>
                                                    new MenuItemViewModel(x.Name, HohoemaPageType.Mylist, new NavigationParameters {
                { "id", x.MylistId }
            }) as HohoemaListingPageItemBase
                                                    )
                      .AddTo(_CompositeDisposable);

            NiconicoSession.LogIn  += OnLogIn;
            NiconicoSession.LogOut += OnLogOut;
        }
示例#3
0
 public MylistCreateCommand(
     LoginUserOwnedMylistManager userMylistManager,
     DialogService dialogService
     )
 {
     UserMylistManager = userMylistManager;
     DialogService     = dialogService;
 }
示例#4
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 MylistCopyItemCommand(
     LoginUserOwnedMylistManager userMylistManager,
     DialogService dialogService,
     NotificationService notificationService
     )
 {
     _userMylistManager   = userMylistManager;
     _dialogService       = dialogService;
     _notificationService = notificationService;
 }
示例#6
0
 public MylistAddItemCommand(
     NotificationService notificationService,
     DialogService dialogService,
     LoginUserOwnedMylistManager userMylistManager
     )
 {
     NotificationService = notificationService;
     _dialogService      = dialogService;
     _userMylistManager  = userMylistManager;
 }
        public MylistSubMenuMenu(LoginUserOwnedMylistManager userMylistManager, ICommand mylistPageOpenCommand)
        {
            Label = "Mylist".Translate();

            _dispatcherQueue      = DispatcherQueue.GetForCurrentThread();
            _userMylistManager    = userMylistManager;
            MylistPageOpenCommand = mylistPageOpenCommand;
            _userMylistManager.Mylists.CollectionChangedAsObservable()
            .Subscribe(e =>
            {
                _dispatcherQueue.TryEnqueue(() =>
                {
                    if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
                    {
                        var items = e.OldItems.Cast <LoginUserMylistPlaylist>();
                        foreach (var removedItem in items)
                        {
                            var removeMenuItem = Items.FirstOrDefault(x => (x as MylistMenuItemViewModel).Mylist.MylistId == removedItem.MylistId);
                            if (removeMenuItem != null)
                            {
                                Items.Remove(removeMenuItem);
                            }
                        }
                    }
                    else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
                    {
                        var items = e.NewItems.Cast <LoginUserMylistPlaylist>();
                        foreach (var item in items)
                        {
                            Items.Add(ToMenuItem(item));
                        }
                    }
                    else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Reset)
                    {
                        Items.Clear();
                    }
                });
            });

            Items = new ObservableCollection <MenuItemViewModel>(_userMylistManager.Mylists.Select(ToMenuItem));
        }
        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 OwnerMylistManagePageViewModel(
            NiconicoSession niconicoSession,
            PageManager pageManager,
            Services.DialogService dialogService,
            ApplicationLayoutManager applicationLayoutManager,
            LoginUserOwnedMylistManager userMylistManager,
            PlaylistPlayAllCommand playlistPlayAllCommand
            )
        {
            _dispatcherQueue         = DispatcherQueue.GetForCurrentThread();
            _niconicoSession         = niconicoSession;
            _pageManager             = pageManager;
            _dialogService           = dialogService;
            ApplicationLayoutManager = applicationLayoutManager;
            _userMylistManager       = userMylistManager;
            PlaylistPlayAllCommand   = playlistPlayAllCommand;

            ItemsView = new AdvancedCollectionView(_sourcePlaylistItems);

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

            OpenMylistCommand.Subscribe(listItem =>
            {
                _pageManager.OpenPageWithId(HohoemaPageType.Mylist, listItem.MylistId);
            });

            AddMylistGroupCommand = new RelayCommand(async() =>
            {
                MylistGroupEditData data = new MylistGroupEditData()
                {
                    Name             = "",
                    Description      = "",
                    IsPublic         = false,
                    DefaultSortKey   = MylistSortKey.AddedAt,
                    DefaultSortOrder = MylistSortOrder.Desc
                };

                // 成功するかキャンセルが押されるまで繰り返す
                while (true)
                {
                    if (true == await _dialogService.ShowCreateMylistGroupDialogAsync(data))
                    {
                        var result = await _userMylistManager.AddMylist(
                            data.Name,
                            data.Description,
                            data.IsPublic,
                            data.DefaultSortKey,
                            data.DefaultSortOrder
                            );

                        if (result != null)
                        {
                            await RefreshPlaylistItems();
                            break;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
                                                     , () => _userMylistManager.Mylists.Count < _userMylistManager.MaxMylistGroupCountCurrentUser
                                                     );

            RemoveMylistGroupCommand = new RelayCommand <LoginUserMylistPlaylist>(async(mylist) =>
            {
                if (mylist.MylistId.IsWatchAfterMylist)
                {
                    return;
                }

                // 確認ダイアログ
                var contentMessage = "ConfirmDeleteX_ImpossibleReDo".Translate(mylist.Name);

                var dialog = new MessageDialog(contentMessage, "ConfirmDeleteX".Translate("Mylist".Translate()));
                dialog.Commands.Add(new UICommand("Delete".Translate(), async(i) =>
                {
                    if (await _userMylistManager.RemoveMylist(mylist.MylistId))
                    {
                        await RefreshPlaylistItems();
                    }
                }));

                dialog.Commands.Add(new UICommand("Cancel".Translate()));
                dialog.CancelCommandIndex  = 1;
                dialog.DefaultCommandIndex = 1;

                await dialog.ShowAsync();
            });


            EditMylistGroupCommand = new RelayCommand <LoginUserMylistPlaylist>(async mylist =>
            {
                if (mylist.MylistId.IsWatchAfterMylist)
                {
                    return;
                }

                MylistGroupEditData data = new MylistGroupEditData()
                {
                    Name             = mylist.Name,
                    Description      = mylist.Description,
                    IsPublic         = mylist.IsPublic,
                    DefaultSortKey   = mylist.DefaultSortKey,
                    DefaultSortOrder = mylist.DefaultSortOrder,
                };

                // 成功するかキャンセルが押されるまで繰り返す
                while (true)
                {
                    if (true == await _dialogService.ShowCreateMylistGroupDialogAsync(data))
                    {
                        if (await mylist.UpdateMylistInfo(data.Name, data.Description, data.IsPublic, data.DefaultSortKey, data.DefaultSortOrder))
                        {
                            break;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            });
        }
        public PrimaryWindowCoreLayoutViewModel(
            ILoggerFactory loggerFactory,
            NiconicoSession niconicoSession,
            PageManager pageManager,
            PinSettings pinSettings,
            AppearanceSettings appearanceSettings,
            SearchCommand searchCommand,
            DialogService dialogService,
            NotificationService notificationService,
            PrimaryViewPlayerManager primaryViewPlayerManager,
            ObservableMediaPlayer observableMediaPlayer,
            NiconicoLoginService niconicoLoginService,
            LogoutFromNiconicoCommand logoutFromNiconicoCommand,
            WindowService windowService,
            ApplicationLayoutManager applicationLayoutManager,
            RestoreNavigationManager restoreNavigationManager,
            VideoItemsSelectionContext videoItemsSelectionContext,
            QueueMenuItemViewModel queueMenuItemViewModel,
            LoginUserOwnedMylistManager userMylistManager,
            LocalMylistManager localMylistManager,
            OpenLiveContentCommand openLiveContentCommand
            )
        {
            _logger                    = loggerFactory.CreateLogger <PrimaryWindowCoreLayoutViewModel>();
            NiconicoSession            = niconicoSession;
            PageManager                = pageManager;
            PinSettings                = pinSettings;
            AppearanceSettings         = appearanceSettings;
            SearchCommand              = searchCommand;
            _dialogService             = dialogService;
            _notificationService       = notificationService;
            PrimaryViewPlayerManager   = primaryViewPlayerManager;
            ObservableMediaPlayer      = observableMediaPlayer;
            NiconicoLoginService       = niconicoLoginService;
            LogoutFromNiconicoCommand  = logoutFromNiconicoCommand;
            WindowService              = windowService;
            ApplicationLayoutManager   = applicationLayoutManager;
            RestoreNavigationManager   = restoreNavigationManager;
            VideoItemsSelectionContext = videoItemsSelectionContext;

            WeakReferenceMessenger.Default.Register <SettingsRestoredMessage>(this);

            SearchAutoSuggestItems = new ObservableCollection <SearchAutoSuggestItemViewModel>
            {
                new SearchAutoSuggestItemViewModel()
                {
                    Id           = "VideoSearchSuggest",
                    SearchAction = (s) => PageManager.Search(SearchTarget.Keyword, s),
                },
                new SearchAutoSuggestItemViewModel()
                {
                    Id           = "LiveSearchSuggest",
                    SearchAction = (s) => PageManager.Search(SearchTarget.Niconama, s),
                },
                new SearchAutoSuggestItemViewModel()
                {
                    Id           = "DetailSearchSuggest",
                    SearchAction = (s) => PageManager.OpenPage(HohoemaPageType.Search, ""),
                },
            };

            _queueMenuItemViewModel          = queueMenuItemViewModel;
            _userMylistManager               = userMylistManager;
            _localMylistManager              = localMylistManager;
            OpenLiveContentCommand           = openLiveContentCommand;
            _pinsMenuSubItemViewModel        = new PinsMenuSubItemViewModel("Pin".Translate(), PinSettings, _dialogService, _notificationService);
            _localMylistMenuSubItemViewModel = new LocalMylistSubMenuItemViewModel(_localMylistManager, PageManager.OpenPageCommand);

            // メニュー項目の初期化
            MenuItems_LoggedIn = new ObservableCollection <HohoemaListingPageItemBase>()
            {
                _pinsMenuSubItemViewModel,
                _queueMenuItemViewModel,
                new LogginUserLiveSummaryItemViewModel(NiconicoSession, _logger, OpenLiveContentCommand),
                new SeparatorMenuItemViewModel(),
                new MenuItemViewModel(HohoemaPageType.RankingCategoryList.Translate(), HohoemaPageType.RankingCategoryList),
                new MenuItemViewModel(HohoemaPageType.NicoRepo.Translate(), HohoemaPageType.NicoRepo),
                new MenuItemViewModel(HohoemaPageType.WatchHistory.Translate(), HohoemaPageType.WatchHistory),
                new MenuItemViewModel("WatchAfterMylist".Translate(), HohoemaPageType.Mylist, new NavigationParameters(("id", MylistId.WatchAfterMylistId.ToString()))),
                new MylistSubMenuMenu(_userMylistManager, PageManager.OpenPageCommand),
                _localMylistMenuSubItemViewModel,
                new MenuItemViewModel(HohoemaPageType.FollowManage.Translate(), HohoemaPageType.FollowManage),
                new MenuItemViewModel(HohoemaPageType.Timeshift.Translate(), HohoemaPageType.Timeshift),
                new MenuItemViewModel(HohoemaPageType.SubscriptionManagement.Translate(), HohoemaPageType.SubscriptionManagement),
                new MenuItemViewModel(HohoemaPageType.CacheManagement.Translate(), HohoemaPageType.CacheManagement),
            };

            MenuItems_Offline = new ObservableCollection <HohoemaListingPageItemBase>()
            {
                _pinsMenuSubItemViewModel,
                _queueMenuItemViewModel,
                new SeparatorMenuItemViewModel(),
                new MenuItemViewModel(HohoemaPageType.RankingCategoryList.Translate(), HohoemaPageType.RankingCategoryList),
                _localMylistMenuSubItemViewModel,
                new MenuItemViewModel(HohoemaPageType.SubscriptionManagement.Translate(), HohoemaPageType.SubscriptionManagement),
                new MenuItemViewModel(HohoemaPageType.CacheManagement.Translate(), HohoemaPageType.CacheManagement),
            };
        }
示例#11
0
        public MylistPageViewModel(
            ILoggerFactory loggerFactory,
            IMessenger messenger,
            ApplicationLayoutManager applicationLayoutManager,
            PageManager pageManager,
            NiconicoSession niconicoSession,
            MylistProvider mylistProvider,
            MylistFollowProvider mylistFollowProvider,
            UserProvider userProvider,
            LoginUserMylistProvider loginUserMylistProvider,
            LoginUserOwnedMylistManager userMylistManager,
            LocalMylistManager localMylistManager,
            MylistResolver mylistRepository,
            SubscriptionManager subscriptionManager,
            MylistUserSelectedSortRepository mylistUserSelectedSortRepository,
            Services.DialogService dialogService,
            AddSubscriptionCommand addSubscriptionCommand,
            SelectionModeToggleCommand selectionModeToggleCommand,
            PlaylistPlayAllCommand playlistPlayAllCommand,
            VideoPlayWithQueueCommand videoPlayWithQueueCommand
            )
        {
            _logger    = loggerFactory.CreateLogger <MylistPageViewModel>();
            _messenger = messenger;
            ApplicationLayoutManager = applicationLayoutManager;
            PageManager                       = pageManager;
            NiconicoSession                   = niconicoSession;
            MylistProvider                    = mylistProvider;
            _mylistFollowProvider             = mylistFollowProvider;
            UserProvider                      = userProvider;
            LoginUserMylistProvider           = loginUserMylistProvider;
            UserMylistManager                 = userMylistManager;
            LocalMylistManager                = localMylistManager;
            _mylistRepository                 = mylistRepository;
            SubscriptionManager               = subscriptionManager;
            _mylistUserSelectedSortRepository = mylistUserSelectedSortRepository;
            DialogService                     = dialogService;
            AddSubscriptionCommand            = addSubscriptionCommand;
            SelectionModeToggleCommand        = selectionModeToggleCommand;
            PlaylistPlayAllCommand            = playlistPlayAllCommand;
            VideoPlayWithQueueCommand         = videoPlayWithQueueCommand;
            Mylist = new ReactiveProperty <MylistPlaylist>();

            SelectedSortOptionItem = new ReactiveProperty <MylistPlaylistSortOption>(mode: ReactivePropertyMode.DistinctUntilChanged);

            CurrentPlaylistToken = Observable.CombineLatest(
                Mylist,
                SelectedSortOptionItem,
                (x, y) => new PlaylistToken(x, y)
                )
                                   .ToReadOnlyReactivePropertySlim()
                                   .AddTo(_CompositeDisposable);


            /*
             * IsFavoriteMylist = new ReactiveProperty<bool>(mode: ReactivePropertyMode.DistinctUntilChanged)
             *  .AddTo(_CompositeDisposable);
             * CanChangeFavoriteMylistState = new ReactiveProperty<bool>()
             *  .AddTo(_CompositeDisposable);
             *
             *
             * IsFavoriteMylist
             *  .Where(x => PlayableList.Value.Id != null)
             *  .Subscribe(async x =>
             *  {
             *      if (PlayableList.Value.Origin != PlaylistOrigin.OtherUser) { return; }
             *
             *      if (_NowProcessFavorite) { return; }
             *
             *      _NowProcessFavorite = true;
             *
             *      CanChangeFavoriteMylistState.Value = false;
             *      if (x)
             *      {
             *          if (await FavoriteMylist())
             *          {
             *              Debug.WriteLine(_MylistTitle + "のマイリストをお気に入り登録しました.");
             *          }
             *          else
             *          {
             *              // お気に入り登録に失敗した場合は状態を差し戻し
             *              Debug.WriteLine(_MylistTitle + "のマイリストをお気に入り登録に失敗");
             *              IsFavoriteMylist.Value = false;
             *          }
             *      }
             *      else
             *      {
             *          if (await UnfavoriteMylist())
             *          {
             *              Debug.WriteLine(_MylistTitle + "のマイリストをお気に入り解除しました.");
             *          }
             *          else
             *          {
             *              // お気に入り解除に失敗した場合は状態を差し戻し
             *              Debug.WriteLine(_MylistTitle + "のマイリストをお気に入り解除に失敗");
             *              IsFavoriteMylist.Value = true;
             *          }
             *      }
             *
             *      CanChangeFavoriteMylistState.Value =
             *          IsFavoriteMylist.Value == true
             || FollowManager.CanMoreAddFollow(FollowItemType.Mylist);
             ||
             ||
             ||     _NowProcessFavorite = false;
             || })
             || .AddTo(_CompositeDisposable);
             ||
             ||
             ||UnregistrationMylistCommand = SelectedItems.ObserveProperty(x => x.Count)
             || .Where(_ => IsUserOwnerdMylist)
             || .Select(x => x > 0)
             || .ToReactiveCommand(false);
             ||
             ||UnregistrationMylistCommand.Subscribe(async _ =>
             ||{
             || if (PlayableList.Value.Origin == PlaylistOrigin.Local)
             || {
             ||     var localMylist = PlayableList.Value as LegacyLocalMylist;
             ||     var items = SelectedItems.ToArray();
             ||
             ||     foreach (var item in items)
             ||     {
             ||         localMylist.Remove(item.PlaylistItem);
             ||         IncrementalLoadingItems.Remove(item);
             ||     }
             || }
             || else if (PlayableList.Value.Origin == PlaylistOrigin.LoginUser)
             || {
             ||     var mylistGroup = HohoemaApp.UserMylistManager.GetMylistGroup(PlayableList.Value.Id);
             ||
             ||     var items = SelectedItems.ToArray();
             ||
             ||
             ||     var action = AsyncInfo.Run<uint>(async (cancelToken, progress) =>
             ||     {
             ||         uint progressCount = 0;
             ||         int successCount = 0;
             ||         int failedCount = 0;
             ||
             ||         Debug.WriteLine($"マイリストに追加解除を開始...");
             ||         foreach (var video in items)
             ||         {
             ||             var unregistrationResult = await mylistGroup.Unregistration(
             ||                 video.RawVideoId
             ||                 , withRefresh: false );
             ||
             ||             if (unregistrationResult == ContentManageResult.Success)
             ||             {
             ||                 successCount++;
             ||             }
             ||             else
             ||             {
             ||                 failedCount++;
             ||             }
             ||
             ||             progressCount++;
             ||             progress.Report(progressCount);
             ||
             ||             Debug.WriteLine($"{video.Label}[{video.RawVideoId}]:{unregistrationResult.ToString()}");
             ||         }
             ||
             ||         // 登録解除結果を得るためリフレッシュ
             ||         await mylistGroup.Refresh();
             ||
             ||
             ||         // ユーザーに結果を通知
             ||         var titleText = $"「{mylistGroup.Label}」から {successCount}件 の動画が登録解除されました";
             ||         var toastService = Microsoft.Toolkit.Mvvm.DependencyInjection.Ioc.Default.GetService<NotificationService>();
             ||         var resultText = $"";
             ||         if (failedCount > 0)
             ||         {
             ||             resultText += $"\n登録解除に失敗した {failedCount}件 は選択されたままです";
             ||         }
             ||         toastService.ShowToast(titleText, resultText);
             ||
             ||         // 登録解除に失敗したアイテムだけを残すように
             ||         // マイリストから除外された動画を選択アイテムリストから削除
             ||         foreach (var item in SelectedItems.ToArray())
             ||         {
             ||             if (false == mylistGroup.CheckRegistratedVideoId(item.RawVideoId))
             ||             {
             ||                 SelectedItems.Remove(item);
             ||                 IncrementalLoadingItems.Remove(item);
             ||             }
             ||         }
             ||
             ||         Debug.WriteLine($"マイリストに追加解除完了---------------");
             ||     });
             ||
             ||     await PageManager.StartNoUIWork("マイリストに追加解除", items.Length, () => action);
             ||
             || }
             ||
             ||
             ||});
             ||
             ||
             */
        }
示例#12
0
        public UserInfoPageViewModel(
            ApplicationLayoutManager applicationLayoutManager,
            UserProvider userProvider,
            UserFollowProvider userFollowProvider,
            VideoFilteringSettings ngSettings,
            NiconicoSession niconicoSession,
            SubscriptionManager subscriptionManager,
            LoginUserOwnedMylistManager userMylistManager,
            PageManager pageManager,
            MylistResolver mylistRepository,
            VideoPlayWithQueueCommand videoPlayWithQueueCommand,
            AddSubscriptionCommand addSubscriptionCommand,
            OpenLinkCommand openLinkCommand
            )
        {
            NiconicoSession           = niconicoSession;
            SubscriptionManager       = subscriptionManager;
            UserMylistManager         = userMylistManager;
            PageManager               = pageManager;
            _mylistRepository         = mylistRepository;
            VideoPlayWithQueueCommand = videoPlayWithQueueCommand;
            AddSubscriptionCommand    = addSubscriptionCommand;
            OpenLinkCommand           = openLinkCommand;
            ApplicationLayoutManager  = applicationLayoutManager;
            UserProvider              = userProvider;
            _userFollowProvider       = userFollowProvider;
            NgSettings = ngSettings;

            HasOwnerVideo = true;

            VideoInfoItems = new ObservableCollection <VideoListItemControlViewModel>();

            OpenUserVideoPageCommand = VideoInfoItems.ObserveProperty(x => x.Count)
                                       .Select(x => x > 0)
                                       .ToReactiveCommand()
                                       .AddTo(_CompositeDisposable);

            OpenUserVideoPageCommand.Subscribe(x =>
            {
                PageManager.OpenPageWithId(HohoemaPageType.UserVideo, UserId);
            })
            .AddTo(_CompositeDisposable);

            IsNGVideoOwner = new ReactiveProperty <bool>(false, ReactivePropertyMode.DistinctUntilChanged);

            IsNGVideoOwner.Subscribe(isNgVideoOwner =>
            {
                if (isNgVideoOwner)
                {
                    NgSettings.AddHiddenVideoOwnerId(UserId, Nickname);
                    IsNGVideoOwner.Value = true;
                    Debug.WriteLine(Nickname + "をNG動画投稿者として登録しました。");
                }
                else
                {
                    NgSettings.RemoveHiddenVideoOwnerId(UserId);
                    IsNGVideoOwner.Value = false;
                    Debug.WriteLine(Nickname + "をNG動画投稿者の指定を解除しました。");
                }
            });
        }
        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();
        }