public LocalPlaylistPageViewModel( ILoggerFactory loggerFactory, IMessenger messenger, ApplicationLayoutManager applicationLayoutManager, PageManager pageManager, LocalMylistManager localMylistManager, NicoVideoProvider nicoVideoProvider, VideoPlayWithQueueCommand videoPlayWithQueueCommand, PlaylistPlayAllCommand playlistPlayAllCommand, LocalPlaylistDeleteCommand localPlaylistDeleteCommand, SelectionModeToggleCommand selectionModeToggleCommand ) : base(loggerFactory.CreateLogger <LocalPlaylistPageViewModel>()) { ApplicationLayoutManager = applicationLayoutManager; _pageManager = pageManager; _localMylistManager = localMylistManager; _nicoVideoProvider = nicoVideoProvider; LocalPlaylistDeleteCommand = localPlaylistDeleteCommand; VideoPlayWithQueueCommand = videoPlayWithQueueCommand; PlaylistPlayAllCommand = playlistPlayAllCommand; SelectionModeToggleCommand = selectionModeToggleCommand; _messenger = messenger; CurrentPlaylistToken = Observable.CombineLatest( this.ObserveProperty(x => x.Playlist), this.ObserveProperty(x => x.SelectedSortOptionItem), (x, y) => new PlaylistToken(x, y) ) .ToReadOnlyReactivePropertySlim() .AddTo(_CompositeDisposable); }
public RelatedVideosSidePaneContentViewModel( string rawVideoId, NicoVideoStreamingSessionProvider nicoVideo, string jumpVideoId, NicoVideoProvider nicoVideoProvider, ChannelProvider channelProvider, MylistProvider mylistProvider, Services.HohoemaPlaylist hohoemaPlaylist, PageManager pageManager ) { Video = nicoVideo; _JumpVideoId = jumpVideoId; NicoVideoProvider = nicoVideoProvider; ChannelProvider = channelProvider; MylistProvider = mylistProvider; HohoemaPlaylist = hohoemaPlaylist; PageManager = pageManager; CurrentVideoId = rawVideoId; _VideoViewerHelpInfo = NicoVideoStreamingSessionProvider.GetVideoRelatedInfomationWithVideoDescription(rawVideoId); HasVideoDescription = _VideoViewerHelpInfo != null; var _ = InitializeRelatedVideos(); }
public RelatedVideosSidePaneContentViewModel( NicoVideoProvider nicoVideoProvider, ChannelProvider channelProvider, MylistRepository mylistRepository, HohoemaPlaylist hohoemaPlaylist, PageManager pageManager, IScheduler scheduler ) { NicoVideoProvider = nicoVideoProvider; ChannelProvider = channelProvider; _mylistRepository = mylistRepository; HohoemaPlaylist = hohoemaPlaylist; PageManager = pageManager; _scheduler = scheduler; HasVideoDescription = _VideoViewerHelpInfo != null; HohoemaPlaylist.ObserveProperty(x => x.CurrentItem) .Subscribe(async item => { Clear(); _IsInitialized = false; await Task.Delay(1000); if (item != null) { await InitializeRelatedVideos(item); } }) .AddTo(_CompositeDisposable); }
public LocalMylistManager( PlaylistRepository playlistRepository, NicoVideoProvider nicoVideoProvider, Services.NotificationService notificationService ) { _playlistRepository = playlistRepository; _nicoVideoProvider = nicoVideoProvider; _notificationService = notificationService; MigrateLocalMylistToPlaylistRepository(_playlistRepository); var localPlaylistEntities = _playlistRepository.GetPlaylistsFromOrigin(Interfaces.PlaylistOrigin.Local); var localPlaylists = localPlaylistEntities.Select(x => new LocalPlaylist(x.Id, _playlistRepository) { Label = x.Label, Count = x.Count }).ToList(); _playlists = new ObservableCollection <LocalPlaylist>(localPlaylists); LocalPlaylists = new ReadOnlyObservableCollection <LocalPlaylist>(_playlists); localPlaylists.ForEach(HandleItemsChanged); foreach (var entity in localPlaylistEntities) { _playlistIdToEntity.Add(entity.Id, entity); } }
public VideoQueuePageViewModel( ILoggerFactory loggerFactory, IMessenger messenger, QueuePlaylist queuePlaylist, QueuePlaylistSetting queuePlaylistSetting, ApplicationLayoutManager applicationLayoutManager, RemoveWatchedItemsInAfterWatchPlaylistCommand removeWatchedItemsInAfterWatchPlaylistCommand, PlaylistPlayAllCommand playlistPlayAllCommand, SelectionModeToggleCommand selectionModeToggleCommand, VideoPlayWithQueueCommand videoPlayWithQueueCommand, NicoVideoProvider nicoVideoProvider ) : base(loggerFactory.CreateLogger <VideoQueuePageViewModel>()) { _messenger = messenger; QueuePlaylist = queuePlaylist; _queuePlaylistSetting = queuePlaylistSetting; ApplicationLayoutManager = applicationLayoutManager; RemoveWatchedItemsInAfterWatchPlaylistCommand = removeWatchedItemsInAfterWatchPlaylistCommand; PlaylistPlayAllCommand = playlistPlayAllCommand; SelectionModeToggleCommand = selectionModeToggleCommand; VideoPlayWithQueueCommand = videoPlayWithQueueCommand; _nicoVideoProvider = nicoVideoProvider; IsEnableGroupingByTitleSimulality = _queuePlaylistSetting.ToReactivePropertyAsSynchronized(x => x.IsGroupingNearByTitleThenByTitleAscending, mode: ReactivePropertyMode.DistinctUntilChanged) .AddTo(_CompositeDisposable); CurrentPlaylistToken = this.ObserveProperty(x => x.SelectedSortOptionItem) .Select(x => new PlaylistToken(QueuePlaylist, x)) .ToReadOnlyReactivePropertySlim() .AddTo(_CompositeDisposable); }
public async Task <object> VisitWatchPage(string rawVideoId) { if (!Helpers.InternetConnection.IsInternet()) { return(null); } object res = null; try { var dmcRes = await NicoVideoProvider.GetDmcWatchResponse(rawVideoId); res = dmcRes; } catch { await Task.Delay(TimeSpan.FromSeconds(1)); res = await NicoVideoProvider.GetWatchApiResponse(rawVideoId); } _LastAccessResponse = res; return(res); }
public HohoemaNotificationService( PageManager pageManager, QueuePlaylist queuePlaylist, HohoemaPlaylistPlayer hohoemaPlaylistPlayer, NiconicoSession niconicoSession, NotificationService notificationService, NicoVideoProvider nicoVideoProvider, MylistProvider mylistProvider, NicoLiveProvider nicoLiveProvider, CommunityProvider communityProvider, UserProvider userProvider, IMessenger messenger ) { PageManager = pageManager; _queuePlaylist = queuePlaylist; _niconicoSession = niconicoSession; NotificationService = notificationService; NicoVideoProvider = nicoVideoProvider; MylistProvider = mylistProvider; NicoLiveProvider = nicoLiveProvider; CommunityProvider = communityProvider; UserProvider = userProvider; _messenger = messenger; }
public VideoPlayRequestBridgeToPlayer( IMessenger messenger, AppearanceSettings appearanceSettings, Lazy <AppWindowSecondaryViewPlayerManager> secondaryPlayerViewManager, Lazy <PrimaryViewPlayerManager> primaryViewPlayerManager, LocalObjectStorageHelper localObjectStorageHelper, QueuePlaylist queuePlaylist, NicoVideoProvider nicoVideoProvider, NicoLiveProvider nicoLiveProvider, PlaylistItemsSourceResolver playlistItemsSourceResolver ) { _messenger = messenger; _appearanceSettings = appearanceSettings; __secondaryPlayerManager = secondaryPlayerViewManager; __primaryViewPlayerManager = primaryViewPlayerManager; _localObjectStorage = localObjectStorageHelper; _queuePlaylist = queuePlaylist; _nicoVideoProvider = nicoVideoProvider; _nicoLiveProvider = nicoLiveProvider; _playlistItemsSourceResolver = playlistItemsSourceResolver; _messenger.Register <VideoPlayRequestMessage>(this); _messenger.Register <PlayerPlayLiveRequestMessage>(this); _messenger.Register <ChangePlayerDisplayViewRequestMessage>(this); }
public RankingCategoryPageViewModel( PageManager pageManager, Services.HohoemaPlaylist hohoemaPlaylist, NicoVideoProvider nicoVideoProvider, RankingSettings rankingSettings, NGSettings ngSettings ) : base(pageManager, useDefaultPageTitle: false) { HohoemaPlaylist = hohoemaPlaylist; NicoVideoProvider = nicoVideoProvider; RankingSettings = rankingSettings; NgSettings = ngSettings; SelectedRankingTarget = RankingSettings.ToReactivePropertyAsSynchronized(x => x.Target, mode: ReactivePropertyMode.DistinctUntilChanged) .AddTo(_CompositeDisposable); SelectedRankingTimeSpan = RankingSettings.ToReactivePropertyAsSynchronized(x => x.TimeSpan, mode: ReactivePropertyMode.DistinctUntilChanged) .AddTo(_CompositeDisposable); IsFailedRefreshRanking = new ReactiveProperty <bool>(false) .AddTo(_CompositeDisposable); CanChangeRankingParameter = new ReactiveProperty <bool>(false) .AddTo(_CompositeDisposable); new[] { SelectedRankingTarget.ToUnit(), SelectedRankingTimeSpan.ToUnit() } .Merge() .Subscribe(__ => { _ = ResetList(); }) .AddTo(_CompositeDisposable); }
public MylistProvider( NiconicoSession niconicoSession, NicoVideoProvider nicoVideoProvider ) : base(niconicoSession) { _nicoVideoProvider = nicoVideoProvider; }
public CopyToClipboardWithShareTextCommand( NotificationService notificationService, NicoVideoProvider nicoVideoProvider ) { _notificationService = notificationService; _nicoVideoProvider = nicoVideoProvider; }
public RecommendProvider( NiconicoSession niconicoSession, NicoVideoProvider nicoVideoProvider ) : base(niconicoSession) { _nicoVideoProvider = nicoVideoProvider; }
public UserProvider(NiconicoSession niconicoSession, NicoVideoOwnerCacheRepository nicoVideoOwnerRepository, NicoVideoProvider nicoVideoProvider ) : base(niconicoSession) { _nicoVideoOwnerRepository = nicoVideoOwnerRepository; _nicoVideoProvider = nicoVideoProvider; }
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 LoginUserMylistProvider( NiconicoSession niconicoSession, NicoVideoProvider nicoVideoProvider, LoginUserMylistItemIdRepository loginUserMylistItemIdRepository ) : base(niconicoSession) { _nicoVideoProvider = nicoVideoProvider; _loginUserMylistItemIdRepository = loginUserMylistItemIdRepository; }
public NicoVideoSessionProvider( NicoVideoProvider nicoVideoProvider, NiconicoSession niconicoSession, NicoVideoSessionOwnershipManager nicoVideoSessionOwnershipManager ) { _nicoVideoProvider = nicoVideoProvider; _niconicoSession = niconicoSession; _nicoVideoSessionOwnershipManager = nicoVideoSessionOwnershipManager; }
public QueuePlaylistIncrementalLoadingSource( QueuePlaylist playlist, QueuePlaylistSortOption sortOption, NicoVideoProvider nicoVideoProvider ) { _playlist = playlist; _sortOption = sortOption; _nicoVideoProvider = nicoVideoProvider; }
public VideoStreamingOriginOrchestrator( NiconicoSession niconicoSession, VideoCacheManager videoCacheManager, NicoVideoSessionProvider nicoVideoSessionProvider, NicoVideoProvider nicoVideoProvider ) { _niconicoSession = niconicoSession; _videoCacheManager = videoCacheManager; _nicoVideoSessionProvider = nicoVideoSessionProvider; _nicoVideoProvider = nicoVideoProvider; }
public VideoInfoRepository( Models.NiconicoSession niconicoSession, NicoVideoProvider nicoVideoProvider, IScheduler scheduler, IBarrel barrel ) : base(niconicoSession) { _nicoVideoProvider = nicoVideoProvider; _scheduler = scheduler; _barrel = barrel; }
public NavigationTriggerFromExternal( MylistResolver mylistResolver, NicoVideoProvider nicoVideoProvider, VideoCacheManager videoCacheManager, PageManager pageManager, IMessenger messenger ) { _mylistResolver = mylistResolver; _nicoVideoProvider = nicoVideoProvider; _videoCacheManager = videoCacheManager; _pageManager = pageManager; _messenger = messenger; }
public SubscriptionManagementPageViewModel( ILoggerFactory loggerFactory, IScheduler scheduler, IMessenger messenger, SubscriptionManager subscriptionManager, SubscriptionUpdateManager subscriptionUpdateManager, DialogService dialogService, PageManager pageManager, NicoVideoProvider nicoVideoProvider, VideoPlayWithQueueCommand videoPlayWithQueueCommand ) { _logger = loggerFactory.CreateLogger <SubscriptionManagementPageViewModel>(); _scheduler = scheduler; _messenger = messenger; _subscriptionManager = subscriptionManager; _subscriptionUpdateManager = subscriptionUpdateManager; _dialogService = dialogService; _pageManager = pageManager; _nicoVideoProvider = nicoVideoProvider; _VideoPlayWithQueueCommand = videoPlayWithQueueCommand; _messenger.Register <SettingsRestoredMessage>(this); Subscriptions = new ObservableCollection <SubscriptionViewModel>(); Subscriptions.CollectionChangedAsObservable() .Throttle(TimeSpan.FromSeconds(0.25)) .Subscribe(_ => { foreach (var(index, vm) in Subscriptions.Select((x, i) => (i, x))) { var subscEntity = vm._source; subscEntity.SortIndex = index + 1; // 新規追加時に既存アイテムを後ろにずらして表示したいため+1 _subscriptionManager.UpdateSubscription(subscEntity); } }) .AddTo(_CompositeDisposable); IsAutoUpdateRunning = _subscriptionUpdateManager.ObserveProperty(x => x.IsRunning) .ToReadOnlyReactiveProperty(false) .AddTo(_CompositeDisposable); AutoUpdateFrequency = _subscriptionUpdateManager.ToReactivePropertyAsSynchronized(x => x.UpdateFrequency) .AddTo(_CompositeDisposable); IsAutoUpdateEnabled = _subscriptionUpdateManager.ToReactivePropertyAsSynchronized(x => x.IsAutoUpdateEnabled) .AddTo(_CompositeDisposable); _subscriptionManager.Added += _subscriptionManager_Added; _subscriptionManager.Removed += _subscriptionManager_Removed; _subscriptionManager.Updated += _subscriptionManager_Updated; }
public RelatedVideoContentsAggregator( NicoVideoProvider nicoVideoProvider, ChannelProvider channelProvider, MylistRepository mylistRepository, HohoemaPlaylist hohoemaPlaylist, PageManager pageManager ) { NicoVideoProvider = nicoVideoProvider; ChannelProvider = channelProvider; _mylistRepository = mylistRepository; HohoemaPlaylist = hohoemaPlaylist; PageManager = pageManager; }
private async Task <InAppNotificationPayload> SubmitVideoContentSuggestion(string videoId) { var nicoVideo = await NicoVideoProvider.GetNicoVideoInfo(videoId); if (nicoVideo.IsDeleted || string.IsNullOrEmpty(nicoVideo.Title)) { return(null); } return(new InAppNotificationPayload() { Content = "InAppNotification_ContentDetectedFromClipboard".Translate(nicoVideo.Title), ShowDuration = DefaultNotificationShowDuration, SymbolIcon = Symbol.Video, IsShowDismissButton = true, Commands = { new InAppNotificationCommand() { Label = "Play".Translate(), Command = new DelegateCommand(() => { Playlist.Play(nicoVideo); NotificationService.DismissInAppNotification(); }) }, new InAppNotificationCommand() { Label = "@view".Translate(), Command = new DelegateCommand(() => { Playlist.AddWatchAfterPlaylist(nicoVideo); NotificationService.DismissInAppNotification(); }) }, new InAppNotificationCommand() { Label = HohoemaPageType.VideoInfomation.Translate(), Command = new DelegateCommand(() => { PageManager.OpenPageWithId(HohoemaPageType.VideoInfomation, videoId); NotificationService.DismissInAppNotification(); }) }, } }); }
public RelatedVideoContentsAggregator( NiconicoSession niconicoSession, NicoVideoProvider nicoVideoProvider, ChannelProvider channelProvider, MylistResolver mylistRepository, PageManager pageManager ) { _niconicoSession = niconicoSession; _nicoVideoProvider = nicoVideoProvider; _channelProvider = channelProvider; _mylistRepository = mylistRepository; _pageManager = pageManager; }
private async Task <InAppNotificationPayload> SubmitVideoContentSuggestion(string videoId) { var nicoVideo = await NicoVideoProvider.GetNicoVideoInfo(videoId); if (nicoVideo.IsDeleted || string.IsNullOrEmpty(nicoVideo.Title)) { return(null); } return(new InAppNotificationPayload() { Content = $"{nicoVideo.Title} をお探しですか?", ShowDuration = DefaultNotificationShowDuration, SymbolIcon = Symbol.Video, IsShowDismissButton = true, Commands = { new InAppNotificationCommand() { Label = "再生", Command = new DelegateCommand(() => { Playlist.PlayVideo(nicoVideo.RawVideoId, nicoVideo.Title); NotificationService.DismissInAppNotification(); }) }, new InAppNotificationCommand() { Label = "あとで見る", Command = new DelegateCommand(() => { Playlist.DefaultPlaylist.AddMylistItem(nicoVideo.RawVideoId); NotificationService.DismissInAppNotification(); }) }, new InAppNotificationCommand() { Label = "動画情報を開く", Command = new DelegateCommand(() => { PageManager.OpenPageWithId(HohoemaPageType.VideoInfomation, videoId); NotificationService.DismissInAppNotification(); }) }, } }); }
private async Task <InAppNotificationPayload> SubmitVideoContentSuggestion(VideoId videoId) { var(res, nicoVideo) = await NicoVideoProvider.GetVideoInfoAsync(videoId); if (res.Video.IsDeleted || string.IsNullOrEmpty(nicoVideo.Title)) { return(null); } return(new InAppNotificationPayload() { Content = "InAppNotification_ContentDetectedFromClipboard".Translate(nicoVideo.Title), ShowDuration = DefaultNotificationShowDuration, IsShowDismissButton = true, Commands = { new InAppNotificationCommand() { Label = "Play".Translate(), Command = new RelayCommand(() => { _messenger.Send(VideoPlayRequestMessage.PlayVideo(videoId)); NotificationService.DismissInAppNotification(); }) }, new InAppNotificationCommand() { Label = "@view".Translate(), Command = new RelayCommand(() => { _queuePlaylist.Add(nicoVideo); NotificationService.DismissInAppNotification(); }) }, new InAppNotificationCommand() { Label = HohoemaPageType.VideoInfomation.Translate(), Command = new RelayCommand(() => { PageManager.OpenPageWithId(HohoemaPageType.VideoInfomation, videoId); NotificationService.DismissInAppNotification(); }) }, } }); }
public CategoryRankingLoadingSource( RankingCategory category, RankingTarget target, RankingTimeSpan timeSpan, NicoVideoProvider nicoVideoProvider, NGSettings ngSettings ) : base() { Category = category; Target = target; TimeSpan = timeSpan; NicoVideoProvider = nicoVideoProvider; NgSettings = ngSettings; }
async Task Views.Extensions.ListViewBase.IDeferInitialize.DeferInitializeAsync() { if (Data?.Title != null) { SetTitle(Data.Title); } _ = RefrechCacheState(); var data = await Task.Run(async() => { if (IsDisposed) { Debug.WriteLine("skip thumbnail loading: " + RawVideoId); return(null); } if (NicoVideoProvider != null) { return(await NicoVideoProvider.GetNicoVideoInfo(RawVideoId)); } // オフライン時はローカルDBの情報を利用する if (Data == null) { return(Database.NicoVideoDb.Get(RawVideoId)); } return(null); }); if (data == null) { return; } Data = data; if (IsDisposed) { Debug.WriteLine("skip thumbnail loading: " + RawVideoId); return; } SetupFromThumbnail(Data); }
public VideoCacheFolderManager( ILoggerFactory loggerFactory, VideoCacheManager vIdeoCacheManager, NicoVideoProvider nicoVideoProvider ) { _logger = loggerFactory.CreateLogger <VideoCacheFolderManager>(); _videoCacheManager = vIdeoCacheManager; _nicoVideoProvider = nicoVideoProvider; _messenger = WeakReferenceMessenger.Default; // キャッシュファイル名の解決方法を設定 VideoCacheManager.ResolveVideoTitle = (id) => { return(_nicoVideoProvider.ResolveVideoTitleAsync(id)); }; }
public LocalMylistManager( ILogger logger, LocalMylistRepository playlistRepository, NicoVideoProvider nicoVideoProvider, INotificationService notificationService ) { _logger = logger; _playlistRepository = playlistRepository; _nicoVideoProvider = nicoVideoProvider; _notificationService = notificationService; _playlists = new ObservableCollection <LocalPlaylist>(); LocalPlaylists = new ReadOnlyObservableCollection <LocalPlaylist>(_playlists); WeakReferenceMessenger.Default.Register <SettingsRestoredMessage>(this); Load(); }