コード例 #1
0
        private void _service_Connected(object sender, PviEventArgs e)
        {
            string serviceName = String.Empty;

            if (sender is Service service)
            {
                serviceName = service.FullName;
            }

            var cpuWrapper      = new CpuWrapper(_service, _eventNotifier);
            var variableWrapper = new VariableWrapper(_service, _eventNotifier);

            var fw         = new FileWrapper();
            var cpuManager = new CpuManager(cpuWrapper);

            var variableInfo = new VariableInfoCollection(fw);

            var variableManager = new VariableManager(variableWrapper, variableInfo);

            var pviEventMsg = Utils.FormatPviEventMessage($"ServiceWrapper._service_Connected; ServiceName={serviceName}", e);

            _eventNotifier.OnPviServiceConnected(sender, new PviApplicationEventArgs()
            {
                Message         = pviEventMsg,
                ServiceWrapper  = this,
                CpuManager      = cpuManager,
                CpuWrapper      = cpuWrapper,
                VariableManager = variableManager,
                VariableWrapper = variableWrapper
            });

            _pollingService = new PollingService(_service, cpuManager);
            _pollingService.Start();
        }