public MainWindow() { InitializeComponent(); _cargoHostEndPoint = new CargoHostEndPoint(ConfigurationManager.AppSettings["CargoHostLocation"], Convert.ToInt32(ConfigurationManager.AppSettings["CargoHostPort"])); _loginInfo = new LoginInfo(); this.DataContext = _loginInfo; }
/// <summary> /// CargoHostInterface. This is the constructor for this /// class. It publishes XI and SNM objects for CargoHost to receive notifications /// /// Arguments: /// /// /// /// none /// Exceptions: /// none /// Return: /// none /// </summary> public CargoHostInterface(EventLoggerAccess logger) { try { string CORBA_NS_Host = (string)System.Configuration.ConfigurationManager.AppSettings["host"]; Int32 CORBA_NS_Port = Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["port"]); _cargoHostEndPoint = new CargoHostEndPoint(CORBA_NS_Host, CORBA_NS_Port); } catch (Exception e) { MessageBox.Show(e.StackTrace); return; } _cargoHostEndPoint.Open(); _logger = 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 { } }