Esempio n. 1
0
        public OverlayWindowViewModel(IReactionHubProxy reactionHubProxy,
                                      IDisplayControlService displayControl,
                                      IUsersActivity usersActivity)
        {
            this.ReactionHub    = reactionHubProxy;
            this.DisplayControl = displayControl;
            this.UsersActivity  = usersActivity;

            this.DisplayTime = this.DisplayControl.DisplayTime
                               .ToReactiveProperty()
                               .AddTo(this.Disposable);
            this.MaxOpacity = this.DisplayControl.MaxOpacity
                              .ToReactiveProperty()
                              .AddTo(this.Disposable);
            this.Scale = this.DisplayControl.Scale
                         .ToReactiveProperty()
                         .AddTo(this.Disposable);
            this.MoveMethod = this.DisplayControl.MoveMethod
                              .ToReactiveProperty()
                              .AddTo(this.Disposable);
            this.OpacityCurve = this.DisplayControl.OpacityCurve
                                .ToReactiveProperty()
                                .AddTo(this.Disposable);
            this.Message = this.UsersActivity
                           .SelectedUser
                           .Select(x => x?.Name ?? "川原's System.")
                           .ToReactiveProperty()
                           .AddTo(this.Disposable);

            this.ReactionHub.Connected += async() =>
            {
                //リアクションの受信設定
                this.ReactionHub.OnReceiveReaction()
                .Subscribe(x => this.OnInteraction(x.Item1, x.Item2))
                .AddTo(this.Disposable);

                //リスナー登録
                var ret = await this.ReactionHub.AddListener();

                if (ret.ResultTypes == eResultTypes.Failed)
                {
                    throw new ArgumentException(ret.Message);
                }
            };
            this.ReactionHub.Open();
        }
        public OverlayShownControlViewModel(IDisplayControlService displayControl)
        {
            this.DisplayControl = displayControl;

            this.DisplayTime  = this.DisplayControl.DisplayTime;
            this.MaxOpacity   = this.DisplayControl.MaxOpacity;
            this.MoveMethod   = this.DisplayControl.MoveMethod;
            this.OpacityCurve = this.DisplayControl.OpacityCurve;
            this.Scale        = this.DisplayControl.Scale;

            this.CurveOptions = ParameterCurveHelpers.GetParameterCurves().ToArray();

            this.SaveCommand = new ReactiveCommand();
            this.SaveCommand
            .Subscribe(_ => { this.DisplayControl.Save(); })
            .AddTo(this.Disposable);

            this.ResetCommand = new ReactiveCommand();
            this.ResetCommand
            .Subscribe(_ => { this.DisplayControl.Load(); })
            .AddTo(this.Disposable);

            this.Title.Value = "Display control";
        }
Esempio n. 3
0
        public bool Initialize(IPlayerPluginContext playerPluginContext, IDictionary<string, string> pluginSettings)
        {
            _PlayerPluginContext = playerPluginContext;

            //Do init with pluginSettings
            int intervalSeconds = 10;
            if (pluginSettings.ContainsKey("intervalSeconds"))
            {
                int i;
                if (Int32.TryParse(pluginSettings["intervalSeconds"], out i))
                {
                    intervalSeconds = i;
                }
                else
                {
                    _PlayerPluginContext.Log(LogLevel.Error, "Failed to parse intervalSeconds from " + pluginSettings["intervalSeconds"]);
                }
            }

            //Register some services
            ITimerService timerService = _PlayerPluginContext.GetService<ITimerService>();
            timerService.RequestRepeatingCallback(new TimeSpan(0, 0, 10), new Action(TimerCallback));

            ICommandService commandService = _PlayerPluginContext.GetService<ICommandService>();
            commandService.RegisterCallback(ExecuteCommand);

            IReceiveDataService receiveDataService = _PlayerPluginContext.GetService<IReceiveDataService>();
            receiveDataService.ValuesChanged += new ValuesChangedEventHandler(receiveDataService_ValuesChanged);

            _DisplayLayoutService = _PlayerPluginContext.GetService<IDisplayLayoutService>();
            _DisplayLayoutService.DisplayLayoutChanged += _DisplayLayoutService_DisplayLayoutChanged;
            LogDisplayLayouts(_DisplayLayoutService.DisplayHeadsLayout, _DisplayLayoutService.VirtualDisplayLayout, _DisplayLayoutService.PhysicalDisplayLayout);

            _DisplayControlService = _PlayerPluginContext.GetService<IDisplayControlService>();

            ISystemInformationService systemInformationService = _PlayerPluginContext.GetService<ISystemInformationService>();
            systemInformationService.AppSettingsChanged += new AppSettingsChangedEventHandler(systemInformationService_AppSettingsChanged);
            _PlayerPluginContext.Log(LogLevel.Information, "System version " + systemInformationService.Version);
            _PlayerPluginContext.Log(LogLevel.Information, "System type " + systemInformationService.Type);
            _PlayerPluginContext.Log(LogLevel.Information, "AppSetting: fileCache=" + systemInformationService.GetAppSetting("fileCache"));

            _SystemDiagnosticsService = _PlayerPluginContext.GetService<ISystemDiagnosticsService>();

            _PlayerPluginContext.SetState(State.OK, "Up and running");

            return true;
        }