protected override void DoInitialize() { logger.Info("Инициализация..."); var appPath = Application.StartupPath + "/"; configuration = LinesConfiguration.LoadFromFile(appPath + "Settings/LinesConfiguration.xml"); var network = ConnectionConfiguration.Default; oracleConnectionHolder = new OracleConnectionHolder(network.OracleConnectionString); oracleConnectionHolder.SetCheckConnectionInterval(TimeSpan.FromMinutes(1)); oracleConnectionHolder.SetReconnectionInterval(TimeSpan.FromMinutes(1)); oracleConnectionHolder.SetHolderName("Oracle"); oracleConnectionHolder.Subscribe(this); opcConnectionHolder = new OpcConnectionHolder(network.OpcServerName, network.OpcServerHost); opcConnectionHolder.SetCheckConnectionInterval(TimeSpan.FromMinutes(1)); opcConnectionHolder.SetReconnectionInterval(TimeSpan.FromMinutes(1)); opcConnectionHolder.SetHolderName("OPC"); opcConnectionHolder.Subscribe(this); dataBuffer = new MemoryBufferImpl(); kppConnector = new KppImpl(); kppConnector.SetConnectionHolder(opcConnectionHolder); var parameters = new List <QueryParameter>(); foreach (var lineConfiguration in configuration.Lines) { parameters.AddRange(lineConfiguration.Parameters); } kppConnector.SetParametersNames(parameters.ToArray()); itsConnector = new ItsImpl(); itsConnector.SetConnectionHoder(oracleConnectionHolder); itsConnector.SetLinesConfiguration(configuration); itsConnector.Initialize(); // Открытие соединений. opcConnectionHolder.TryConnect(); oracleConnectionHolder.TryConnect(); opcConnectionHolder.Start(); oracleConnectionHolder.Start(); checkTimer = new Timer(checkInterval.TotalMilliseconds); checkTimer.Elapsed += CheckerTimerTick; backgroundWorker = new BackgroundWorker(); backgroundWorker.DoWork += DoCheckLines; logger.Info("Инициализация завершена."); }
public void SetConnectionHolder(OpcConnectionHolder aConnectionHolder) { opcConnection = aConnectionHolder; }
public void SetConnectionHolder(OpcConnectionHolder aConnectionHolder) { connectionHolder = aConnectionHolder; }