Beispiel #1
0
        protected override void DoInitialize()
        {
            logger.Info("Инициализация...");
            var appPath = Application.StartupPath + "/";
            dimentionConfiguration = new NHibernateDimentionConfigurationImpl();
            dataProviderConfiguration = new XmlDataProviderConfigurationImpl(appPath + "Settings/OpcConfiguration.xml");
            sensorConfiguration = new XmlSensorConfigurationImpl(appPath + "Settings/SensorConfiguration.xml");

            dataProvider = new OpcDataProviderImpl();
            calibrator = new CalibratorImpl();
            //dataProvider = new EmulatorDataProvider();
            //calibrator = dataProvider as ICalibrator;

            slabBuilder = new SlabBuilderImpl();
            dimentionCalculator = new DimentionCalculatorImpl();
            sensorValueContainer = new SensorValueContainerImpl();
            dimentionValueContainer = new DimentionValueContainerImpl();
            standartSizeReaderWriter = new NHibernateStandartSizeReaderWriter();
            regulationsReaderWriter = new NHibernateRegulationReaderWriter();

            sensorValueReaderWriter = new NHibernateSensorValueWriter();
            dimentionValueWriter = new NHibernateDimentionValueWriter();
            slabWriter = new NHibernateSlabInfoWriter();
            slabReader = slabWriter as ISlabInfoReader;

            //dataCleaner = new NHibernateDataCleanerImpl();
            //dataCleaner.SetSlabInfoWriter(slabWriter);

            sensorValueContainer.SunbscribeContainerListener(this);

            dataProvider.SetSensorConfiguration(sensorConfiguration);
            dataProvider.SetSensorValueContainer(sensorValueContainer);
            dataProvider.SetDataProviderConfiguration(dataProviderConfiguration);
            dataProvider.SubscribeDataProviderListener(this);

            slabBuilder.SetCalibrator(calibrator);
            slabBuilder.SetSensorConfiguration(sensorConfiguration);
            slabBuilder.SetSensorValueContainer(sensorValueContainer);

            dimentionCalculator.SetDimentionConfiguration(dimentionConfiguration);
            dimentionCalculator.SetDimentionValueContainer(dimentionValueContainer);

            // Для построения точек при запросе пользователя.
            userSensorValueContainer = new SensorValueContainerImpl();
            userSlabBuilder = new SlabBuilderImpl();
            userSlabBuilder.SetSensorValueContainer(userSensorValueContainer);
            userSlabBuilder.SetSensorConfiguration(sensorConfiguration);
            userSlabBuilder.SetCalibrator(calibrator);

            dimentionConfiguration.Initialize();
            standartSizeReaderWriter.Initialize();
            regulationsReaderWriter.Initialize();
            dataProviderConfiguration.Initialize();
            sensorConfiguration.Initialize();
            sensorValueReaderWriter.Initialize();
            slabWriter.Initialize();
            dimentionValueWriter.Initialize();
            dimentionCalculator.Initialize();
            calibrator.Initialize();
            slabBuilder.Initialize();
            userSlabBuilder.Initialize();
            //dataCleaner.Initialize();
            dataProvider.Initialize();

            logger.Info("Инициализация завершена.");
        }