public CommentFilteringNGScoreZeroFixture(
     CommentFilteringFacade commentFiltering,
     AppFlagsRepository appFlagsRepository
     )
 {
     _appFlagsRepository = appFlagsRepository;
     _commentFiltering   = commentFiltering;
 }
        public SettingsSidePaneContentViewModel(
            VideoFilteringSettings videoFilteringRepository,
            PlayerSettings playerSettings,
            CommentFilteringFacade commentFiltering,
            IScheduler scheduler
            )
        {
            _videoFilteringRepository = videoFilteringRepository;
            PlayerSettings            = playerSettings;
            CommentFiltering          = commentFiltering;
            _scheduler = scheduler;


            FilteringKeywords = new ObservableCollection <CommentFliteringRepository.FilteringCommentTextKeyword>(CommentFiltering.GetAllFilteringCommentTextCondition());
            Observable.FromEventPattern <CommentFilteringFacade.FilteringCommentTextKeywordEventArgs>(
                h => CommentFiltering.FilterKeywordAdded += h,
                h => CommentFiltering.FilterKeywordAdded -= h
                )
            .Subscribe(args =>
            {
                FilteringKeywords.Add(args.EventArgs.FilterKeyword);
            })
            .AddTo(_CompositeDisposable);

            Observable.FromEventPattern <CommentFilteringFacade.FilteringCommentTextKeywordEventArgs>(
                h => CommentFiltering.FilterKeywordRemoved += h,
                h => CommentFiltering.FilterKeywordRemoved -= h
                )
            .Subscribe(args =>
            {
                FilteringKeywords.Remove(args.EventArgs.FilterKeyword);
            })
            .AddTo(_CompositeDisposable);

            //
            VideoCommentTransformConditions = new ObservableCollection <CommentFliteringRepository.CommentTextTransformCondition>(CommentFiltering.GetTextTranformConditions());
            Observable.FromEventPattern <CommentFilteringFacade.CommentTextTranformConditionChangedArgs>(
                h => CommentFiltering.TransformConditionAdded += h,
                h => CommentFiltering.TransformConditionAdded -= h
                )
            .Subscribe(args =>
            {
                VideoCommentTransformConditions.Add(args.EventArgs.TransformCondition);
            })
            .AddTo(_CompositeDisposable);

            Observable.FromEventPattern <CommentFilteringFacade.CommentTextTranformConditionChangedArgs>(
                h => CommentFiltering.TransformConditionRemoved += h,
                h => CommentFiltering.TransformConditionRemoved -= h
                )
            .Subscribe(args =>
            {
                VideoCommentTransformConditions.Remove(args.EventArgs.TransformCondition);
            })
            .AddTo(_CompositeDisposable);
        }
 public MigrationCommentFilteringSettings(
     AppFlagsRepository appFlagsRepository,
     PlayerSettings playerSettings,
     CommentFilteringFacade commentFiltering
     )
 {
     _appFlagsRepository = appFlagsRepository;
     _playerSettings     = playerSettings;
     _commentFiltering   = commentFiltering;
 }
示例#4
0
        public VideoCommentSidePaneContentViewModel(
            VideoCommentPlayer commentPlayer,
            CommentFilteringFacade commentFiltering,
            Services.DialogService dialogService
            )
        {
            CommentPlayer    = commentPlayer;
            CommentFiltering = commentFiltering;
            _dialogService   = dialogService;
            Comments         = new AdvancedCollectionView(CommentPlayer.Comments, true);

            HandleCommentFilterConditionChanged();

            void HandleCommentFilterConditionChanged()
            {
#pragma warning disable IDISP004 // Don't ignore created IDisposable.
                new[]
                {
                    Observable.FromEventPattern <CommentFilteringFacade.CommentOwnerIdFilteredEventArgs>(
                        h => CommentFiltering.FilteringCommentOwnerIdAdded += h,
                        h => CommentFiltering.FilteringCommentOwnerIdAdded -= h
                        ).ToUnit(),
                    Observable.FromEventPattern <CommentFilteringFacade.CommentOwnerIdFilteredEventArgs>(
                        h => CommentFiltering.FilteringCommentOwnerIdRemoved += h,
                        h => CommentFiltering.FilteringCommentOwnerIdRemoved -= h
                        ).ToUnit(),

                    Observable.FromEventPattern <CommentFilteringFacade.FilteringCommentTextKeywordEventArgs>(
                        h => CommentFiltering.FilterKeywordAdded += h,
                        h => CommentFiltering.FilterKeywordAdded -= h
                        ).ToUnit(),
                    Observable.FromEventPattern <CommentFilteringFacade.FilteringCommentTextKeywordEventArgs>(
                        h => CommentFiltering.FilterKeywordUpdated += h,
                        h => CommentFiltering.FilterKeywordUpdated -= h
                        ).ToUnit(),
                    Observable.FromEventPattern <CommentFilteringFacade.FilteringCommentTextKeywordEventArgs>(
                        h => CommentFiltering.FilterKeywordRemoved += h,
                        h => CommentFiltering.FilterKeywordRemoved -= h
                        ).ToUnit(),
                }
                .Merge()
                .Subscribe(_ => Comments.RefreshFilter())
#pragma warning restore IDISP004 // Don't ignore created IDisposable.
                .AddTo(_disposables);

                using (Comments.DeferRefresh())
                {
                    Comments.SortDescriptions.Add(new SortDescription("VideoPosition", SortDirection.Ascending));
                    Comments.Filter = (c) => !isCommentFiltered(c as VideoComment);
                }
            }
        }
示例#5
0
        public LiveCommentsSidePaneContentViewModel(
            CommentFilteringFacade commentFiltering,
            IScheduler scheduler,
            NicoVideoOwnerCacheRepository nicoVideoOwnerRepository,
            OpenLinkCommand openLinkCommand,
            CopyToClipboardCommand copyToClipboardCommand
            )
        {
            _playerSettings                   = commentFiltering;
            _scheduler                        = scheduler;
            _nicoVideoOwnerRepository         = nicoVideoOwnerRepository;
            OpenLinkCommand                   = openLinkCommand;
            CopyToClipboardCommand            = copyToClipboardCommand;
            NicoLiveUserIdAddToNGCommand      = new NicoLiveUserIdAddToNGCommand(_playerSettings, _nicoVideoOwnerRepository);
            NicoLiveUserIdRemoveFromNGCommand = new NicoLiveUserIdRemoveFromNGCommand(_playerSettings);
            IsCommentListScrollWithVideo      = new ReactiveProperty <bool>(_scheduler, false)
                                                .AddTo(_CompositeDisposable);

            NGUsers = new ObservableCollection <CommentFliteringRepository.FilteringCommentOwnerId>(_playerSettings.GetFilteringCommentOwnerIdList());
            IsNGCommentUserIdEnabled = _playerSettings.ToReactivePropertyAsSynchronized(x => x.IsEnableFilteringCommentOwnerId, _scheduler)
                                       .AddTo(_CompositeDisposable);
        }
 public NicoLiveUserIdRemoveFromNGCommand(CommentFilteringFacade playerSettings)
 {
     _playerSettings = playerSettings;
 }
 public NicoLiveUserIdAddToNGCommand(CommentFilteringFacade playerSettings, NicoVideoOwnerCacheRepository nicoVideoOwnerRepository)
 {
     _commentFiltering         = playerSettings;
     _nicoVideoOwnerRepository = nicoVideoOwnerRepository;
 }