public override void Dispose()
        {
            try
            {
                if (/*exists (avoid first try exceptions)?*/ _rawDataAccess != null)
                {
                    _rawDataAccess.Dispose();
                }
            }
            catch { }
            finally { _rawDataAccess = null; }

            try
            {
                if (/*exists (avoid first try exceptions)?*/ _realTimeViewer != null)
                {
                    _realTimeViewer.Dispose();
                }
            }
            catch { }
            finally { _realTimeViewer = null; }

            try
            {
                if (/*exists (avoid first try exceptions)?*/ _detectorsAccess != null)
                {
                    _detectorsAccess.Dispose();
                }
            }
            catch { }
            finally { _detectorsAccess = null; }

            try
            {
                if (/*exists (avoid first try exceptions)?*/ _apcsAccess != null)
                {
                    _apcsAccess.Dispose();
                }
            }
            catch { }
            finally { _apcsAccess = null; }

            try
            {
                if (/*exists (avoid first try exceptions)?*/ _cargoHostEndPoint != null)
                {
                    _cargoHostEndPoint.Close();
                }
            }
            catch { }
            finally { _cargoHostEndPoint = null; }

            try { base.Dispose(); } catch { }
        }
        public DetectorsDataAccess(EventLoggerAccess logger) :
            base(logger)
        {
            _logger = logger;

            _detectorsAccess             = new DetectorsAccess(_logger);
            _detectorsAccess.ReadyEvent += new ConnectionStateChangeHandler(OnDetectorsChange);

            _apcsAccess             = new ApcsAccess(logger);
            _apcsAccess.ReadyEvent += new ConnectionStateChangeHandler(OnApcsChange);

            _apcsAccess.Start();
            _detectorsAccess.Start();

            _OpcTags        = new OpcTags();
            base.TagUpdate += new PLCTagUpdateHandler(_OpcTags.DataAccess_TagUpdate);
            base.TagUpdate += new PLCTagUpdateHandler(DetectorsDataAccess_TagUpdate);

            _cargoHostEndPoint = new CargoHostEndPoint(AppConfiguration.CargoHostServer, AppConfiguration.CargoHostPort);
            _logger.LogInfo("Cargo Host HostEndPoint is " + _cargoHostEndPoint.IPAddress + ":" + _cargoHostEndPoint.IPPort.ToString());

            _rawDataAccess  = new RawDataAccess(_logger, _detectorsAccess);
            _realTimeViewer = new RealTimeViewer(_logger);
        }
        public DetectorsDataAccess(EventLoggerAccess logger) :
            base(logger)
        {
            _logger = logger;

            _detectorsAccess = new DetectorsAccess(_logger);
            _detectorsAccess.ReadyEvent += new ConnectionStateChangeHandler(OnDetectorsChange);

            _apcsAccess = new ApcsAccess(logger);
            _apcsAccess.ReadyEvent += new ConnectionStateChangeHandler(OnApcsChange);

            _apcsAccess.Start();
            _detectorsAccess.Start();

            _OpcTags = new OpcTags();
            base.TagUpdate += new PLCTagUpdateHandler(_OpcTags.DataAccess_TagUpdate);
            base.TagUpdate += new PLCTagUpdateHandler(DetectorsDataAccess_TagUpdate);

            _cargoHostEndPoint = new CargoHostEndPoint(AppConfiguration.CargoHostServer, AppConfiguration.CargoHostPort);
            _logger.LogInfo("Cargo Host HostEndPoint is " + _cargoHostEndPoint.IPAddress + ":" + _cargoHostEndPoint.IPPort.ToString());

            _rawDataAccess = new RawDataAccess(_logger, _detectorsAccess);
            _realTimeViewer = new RealTimeViewer(_logger);
        }
        public override void Dispose()
        {
            try
            {
                if (/*exists (avoid first try exceptions)?*/ _rawDataAccess != null)
                    _rawDataAccess.Dispose();
            }
            catch { }
            finally { _rawDataAccess = null; }

            try
            {
                if (/*exists (avoid first try exceptions)?*/ _realTimeViewer != null)
                    _realTimeViewer.Dispose();
            }
            catch { }
            finally { _realTimeViewer = null; }

            try
            {
                if (/*exists (avoid first try exceptions)?*/ _detectorsAccess != null)
                    _detectorsAccess.Dispose();
            }
            catch { }
            finally { _detectorsAccess = null; }

            try
            {
                if (/*exists (avoid first try exceptions)?*/ _apcsAccess != null)
                    _apcsAccess.Dispose();
            }
            catch { }
            finally { _apcsAccess = null; }

            try
            {
                if (/*exists (avoid first try exceptions)?*/ _cargoHostEndPoint != null)
                    _cargoHostEndPoint.Close();
            }
            catch { }
            finally { _cargoHostEndPoint = null; }

            try { base.Dispose(); } catch { }
        }