Example #1
0
        public bool Initialize(IPlayerPluginContext playerPluginContext, IDictionary<string, string> pluginSettings)
        {
            _PlayerPluginContext = playerPluginContext;

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

            return true;
        }
Example #2
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;
        }