public BackupManager(LocalMylistRepository playlistRepository, SubscriptionRegistrationRepository subscriptionRegistrationRepository, PinSettings pinSettings, VideoRankingSettings videoRankingSettings, VideoFilteringSettings videoFilteringSettings, PlayerSettings playerSettings, AppearanceSettings appearanceSettings, NicoRepoSettings nicoRepoSettings, CommentFliteringRepository commentFliteringRepository ) { _playlistRepository = playlistRepository; _subscriptionRegistrationRepository = subscriptionRegistrationRepository; _pinSettings = pinSettings; _videoRankingSettings = videoRankingSettings; _videoFilteringSettings = videoFilteringSettings; _playerSettings = playerSettings; _appearanceSettings = appearanceSettings; _nicoRepoSettings = nicoRepoSettings; _commentFliteringRepository = commentFliteringRepository; _options = new JsonSerializerOptions() { WriteIndented = true, PropertyNameCaseInsensitive = true, Converters = { new JsonStringEnumMemberConverter(), } }; }
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 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 HiddenVideoOwnerAddCommand( VideoFilteringSettings ngSettings, ChannelProvider channelProvider, UserProvider userProvider, NicoVideoOwnerCacheRepository nicoVideoOwnerRepository ) { NgSettings = ngSettings; ChannelProvider = channelProvider; UserProvider = userProvider; _nicoVideoOwnerRepository = nicoVideoOwnerRepository; }
public SettingsMigration_V_0_23_0( AppFlagsRepository appFlagsRepository, Domain.Application.AppearanceSettings appearanceSettings, Domain.Pins.PinSettings pinSettings, VideoRankingSettings videoRankingSettings, VideoFilteringSettings videoFilteringRepository, PlayerSettings playerSettings ) { _appFlagsRepository = appFlagsRepository; _appearanceSettings = appearanceSettings; _pinSettings = pinSettings; _videoRankingSettings = videoRankingSettings; _videoFilteringRepository = videoFilteringRepository; _playerSettings = playerSettings; }
public VideoFilteringTitleViewModel( VideoTitleFilteringEntry ngTitleInfo, Action <VideoTitleFilteringEntry> onRemoveAction, VideoFilteringSettings videoFilteringRepository, IObservable <string> testKeyword ) { NGKeywordInfo = ngTitleInfo; _OnRemoveAction = onRemoveAction; _videoFilteringRepository = videoFilteringRepository; Label = NGKeywordInfo.Keyword; Keyword = new ReactiveProperty <string>(NGKeywordInfo.Keyword); Keyword.Subscribe(x => { NGKeywordInfo.Keyword = x; }) .AddTo(_disposables); IsValidKeyword = Keyword .Where(x => !string.IsNullOrWhiteSpace(x)) .Select(x => { try { _ = new Regex(x); return(true); } catch { return(false); } }) .ToReactiveProperty(mode: ReactivePropertyMode.RaiseLatestValueOnSubscribe) .AddTo(_disposables); IsInvalidKeyword = IsValidKeyword.Select(x => !x) .ToReactiveProperty() .AddTo(_disposables); IsValidKeyword.Where(x => x).Subscribe(_ => { _videoFilteringRepository.UpdateVideoTitleFiltering(NGKeywordInfo); }) .AddTo(_disposables); IsTestPassed = testKeyword .Where(x => !string.IsNullOrWhiteSpace(x)) .Where(_ => IsValidKeyword.Value) .Select(x => { return(Regex.IsMatch(Keyword.Value, x)); }) .ToReadOnlyReactivePropertySlim(); RemoveCommand = new RelayCommand(() => { _OnRemoveAction(this.NGKeywordInfo); }); }
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 HiddenVideoOwnerRemoveCommand(VideoFilteringSettings ngSettings) { _ngSettings = ngSettings; }
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動画投稿者の指定を解除しました。"); } }); }