Example #1
0
        public VideoItemsListView()
        {
            this.InitializeComponent();

            // Selection
            _selectionContext = App.Current.Container.Resolve <VideoItemsSelectionContext>();

            // Update Video Item
            _videoInfoRepository = App.Current.Container.Resolve <Repository.NicoVideo.VideoInfoRepository>();

            Loaded   += VideoItemsListView_Loaded;
            Unloaded += VideoItemsListView_Unloaded;

            // Note: Loadedで登録すると速いCPUだと先頭数個の表示要素が漏れることからコンストラクタで登録している
            ItemsList.ContainerContentChanging += ItemsList_ContainerContentChanging;
        }
        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;
        }
Example #3
0
 public PrimaryWindowCoreLayoutViewModel(
     IEventAggregator eventAggregator,
     NiconicoSession niconicoSession,
     PageManager pageManager,
     PinSettings pinSettings,
     AppearanceSettings appearanceSettings,
     UseCase.Page.Commands.SearchCommand searchCommand,
     PinRemoveCommand pinRemoveCommand,
     PinChangeOverrideLabelCommand pinChangeOverrideLabelCommand,
     VideoMenuSubPageContent videoMenuSubPageContent,
     LiveMenuSubPageContent liveMenuSubPageContent,
     PrimaryViewPlayerManager primaryViewPlayerManager,
     ObservableMediaPlayer observableMediaPlayer,
     NiconicoLoginService niconicoLoginService,
     LogoutFromNiconicoCommand logoutFromNiconicoCommand,
     VideoItemsSelectionContext videoItemsSelectionContext,
     WindowService windowService,
     ApplicationLayoutManager applicationLayoutManager
     )
 {
     EventAggregator               = eventAggregator;
     NiconicoSession               = niconicoSession;
     PageManager                   = pageManager;
     PinSettings                   = pinSettings;
     AppearanceSettings            = appearanceSettings;
     SearchCommand                 = searchCommand;
     PinRemoveCommand              = pinRemoveCommand;
     PinChangeOverrideLabelCommand = pinChangeOverrideLabelCommand;
     VideoMenu = videoMenuSubPageContent;
     LiveMenu  = liveMenuSubPageContent;
     PrimaryViewPlayerManager   = primaryViewPlayerManager;
     ObservableMediaPlayer      = observableMediaPlayer;
     NiconicoLoginService       = niconicoLoginService;
     LogoutFromNiconicoCommand  = logoutFromNiconicoCommand;
     VideoItemsSelectionContext = videoItemsSelectionContext;
     WindowService            = windowService;
     ApplicationLayoutManager = applicationLayoutManager;
 }
        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),
            };
        }