Beispiel #1
0
        public SettingsLiveInfoContentViewModel(NicoLiveVideo liveVideo, HohoemaApp hohoemaApp)
        {
            _PlayerSettings = hohoemaApp.UserSettings.PlayerSettings;


            CommentRenderingFPS = _PlayerSettings.ToReactivePropertyAsSynchronized(x => x.CommentRenderingFPS)
                                  .AddTo(_CompositeDisposable);
            CommentDisplayDuration = _PlayerSettings.ToReactivePropertyAsSynchronized(x => x.CommentDisplayDuration, x => x.TotalSeconds, x => TimeSpan.FromSeconds(x))
                                     .AddTo(_CompositeDisposable);
            CommentFontScale = _PlayerSettings.ToReactivePropertyAsSynchronized(x => x.DefaultCommentFontScale)
                               .AddTo(_CompositeDisposable);
            CommentColor = _PlayerSettings.ToReactivePropertyAsSynchronized(x => x.CommentColor)
                           .AddTo(_CompositeDisposable);
            ScrollVolumeFrequency = _PlayerSettings.ToReactivePropertyAsSynchronized(x => x.ScrollVolumeFrequency)
                                    .AddTo(_CompositeDisposable);

            Observable.Merge(
                CommentRenderingFPS.ToUnit(),
                CommentDisplayDuration.ToUnit(),
                CommentFontScale.ToUnit(),
                CommentColor.ToUnit(),
                ScrollVolumeFrequency.ToUnit()
                )
            .SubscribeOnUIDispatcher()
            .Subscribe(_ => _PlayerSettings.Save().ConfigureAwait(false))
            .AddTo(_CompositeDisposable);
        }
Beispiel #2
0
        public SettingsVideoInfoContentViewModel(PlayerSettings settings)
        {
            _PlayerSettings = settings;


            DefaultCommentDisplay = _PlayerSettings.ToReactivePropertyAsSynchronized(x => x.DefaultCommentDisplay)
                                    .AddTo(_CompositeDisposable);
            CommentRenderingFPS = _PlayerSettings.ToReactivePropertyAsSynchronized(x => x.CommentRenderingFPS)
                                  .AddTo(_CompositeDisposable);
            CommentDisplayDuration = _PlayerSettings.ToReactivePropertyAsSynchronized(x => x.CommentDisplayDuration, x => x.TotalSeconds, x => TimeSpan.FromSeconds(x))
                                     .AddTo(_CompositeDisposable);
            CommentFontScale = _PlayerSettings.ToReactivePropertyAsSynchronized(x => x.DefaultCommentFontScale)
                               .AddTo(_CompositeDisposable);
            CommentColor = _PlayerSettings.ToReactivePropertyAsSynchronized(x => x.CommentColor)
                           .AddTo(_CompositeDisposable);
            IsPauseWithCommentWriting = _PlayerSettings.ToReactivePropertyAsSynchronized(x => x.PauseWithCommentWriting)
                                        .AddTo(_CompositeDisposable);
            IsKeepDisplayInPlayback = _PlayerSettings.ToReactivePropertyAsSynchronized(x => x.IsKeepDisplayInPlayback)
                                      .AddTo(_CompositeDisposable);
            ScrollVolumeFrequency = _PlayerSettings.ToReactivePropertyAsSynchronized(x => x.ScrollVolumeFrequency)
                                    .AddTo(_CompositeDisposable);

            Observable.Merge(
                DefaultCommentDisplay.ToUnit(),
                CommentRenderingFPS.ToUnit(),
                CommentDisplayDuration.ToUnit(),
                CommentFontScale.ToUnit(),
                CommentColor.ToUnit(),
                IsKeepDisplayInPlayback.ToUnit(),
                IsPauseWithCommentWriting.ToUnit(),
                ScrollVolumeFrequency.ToUnit()
                )
            .SubscribeOnUIDispatcher()
            .Subscribe(_ => _PlayerSettings.Save().ConfigureAwait(false))
            .AddTo(_CompositeDisposable);
        }