Пример #1
0
        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 { }
        }
Пример #2
0
        private void CheckCargoHostConnection(object stateInfo)
        {
            try
            {
                if (!_cargoHostEndPoint.IsConnected)
                {
                    _cargoHostEndPoint.Open();
                }

                _loginInfo.IsConnected = _cargoHostEndPoint.IsHostAvailable;
            }
            catch
            {
                if (_cargoHostEndPoint.IsConnected)
                {
                    _cargoHostEndPoint.Close();
                }
                _loginInfo.IsConnected = false;
            }
        }