/// <summary>Create and prepare a new class instance.</summary> /// <param name="eventLogger"> /// Logger Reference specifies a <see cref="EventLoggerAccess"/> instance and must not be /// null.</param> /// <remarks>This class is a singleton: only one instance may exist at a time.</remarks> /// <exception cref="ArgumentNullException"> /// If <paramref name="eventLogger"/> specifies null, an exception is thrown.</exception> /// <exception cref="Exception"> /// If an instance of this class exists, already, an exception is thrown.</exception> public ApcsAccess(EventLoggerAccess eventLogger) { if (/*already instantiated?*/ Logger != null) throw new Exception(ClassName + " is a singleton; only one instance may exist at any one time"); if (/*invalid?*/ eventLogger == null) throw new ArgumentNullException(ClassName + " logger reference (eventLogger) must not be null"); Logger = eventLogger; Logger.LogInfo("+++" + ClassName + "+++"); }
public RealTimeViewerHost(string address, int dataPort, int udpClientPort, EventLoggerAccess logger) { _logger = logger; IPAddress multicastAddress = IPAddress.Parse(address); _udpClient = new UdpClient(udpClientPort); _udpClient.JoinMulticastGroup(multicastAddress); _udpClient.Ttl = 255; _udpClient.Connect(new IPEndPoint(multicastAddress, dataPort)); _logger.LogInfo(MethodBase.GetCurrentMethod().Name + ": joined multicast group " + multicastAddress.ToString() + ":" + udpClientPort.ToString()); }
public MainWindow() { InitializeComponent(); _eventLoggerAccess = new EventLoggerAccess(); _eventLoggerAccess.LogMessageUpdate += new LogMessageUpdateHandler(LogMessage); _eventLoggerAccess.LogInfo("DetectorsApp Started"); _dataAccess = new DetectorsDataAccess(_eventLoggerAccess); _businessManager = new BusinessManager(_dataAccess, _eventLoggerAccess); _dataAccess.Connect(); CurrentLineIdTextBlk.DataContext = _dataAccess.Detectors; TestAPCS.Content = new TestAPCS(_dataAccess); TestNCB.Content = new TestNCB(_dataAccess, _businessManager); TestAPCS.Visibility = AppConfiguration.ShowDebugDisplays ? Visibility.Visible : Visibility.Collapsed; TestNCB.Visibility = TestAPCS.Visibility; }
public App() { bool createdNew = true; mutex = new Mutex(true, "Dashboard", out createdNew); if (createdNew) { if (Environment.GetCommandLineArgs().Length > 1) { foreach (string arg in Environment.GetCommandLineArgs()) { if (string.Compare(arg, "Operator", true) == 0 || string.Compare(arg, "Supervisor", true) == 0 || string.Compare(arg, "Maintenance", true) == 0 || string.Compare(arg, "Engineer", true) == 0) { ConfigurationManager.AppSettings["SystemOperationMode"] = arg; break; } } EventLoggerAccess logger = new EventLoggerAccess(); _UIManager = new UIManager(logger); _DataAccess = new DataAccess(logger); _AssemblyManager = new AssemblyManager(_UIManager, _DataAccess, logger); _DataAccess.StartUp(); _UIManager.Show(); logger.LogInfo("Dashboard Client Started"); } else { Application.Current.Shutdown(); } } else { Process current = Process.GetCurrentProcess(); foreach (Process process in Process.GetProcessesByName(current.ProcessName)) { SetForegroundWindow(process.MainWindowHandle); } Application.Current.Shutdown(); } }
public BusinessManager(DetectorsDataAccess dataAccess, EventLoggerAccess log) { _dataAccess = dataAccess; _log = log; _statusManager = new DetectorsStatusManager(dataAccess, log); _requestManager = new RequestManager(dataAccess, (StatusManager)_statusManager, log); log.LogInfo("Using calibration: " + AppConfiguration.CalibrationMode.ToString()); if (AppConfiguration.CalibrationMode == AppConfiguration.CalibrationModeEnum.Inline) _calibration = new CalibrationInline(log, _dataAccess, _statusManager); else if (AppConfiguration.CalibrationMode == AppConfiguration.CalibrationModeEnum.Persistent) _calibration = new CalibrationPersistent(log, _dataAccess, _statusManager); else if (AppConfiguration.CalibrationMode == AppConfiguration.CalibrationModeEnum.InlineStandstill) _calibration = new CalibrationInline(log, _dataAccess, _statusManager); _normalize = new NormalizeData(log, dataAccess, _calibration); _processThread = Threads.Create(ProcessDataThreadMethod, ref _processEnd, "Business Data thread"); _processThread.Start(); }
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 DetectorsAccess(EventLoggerAccess eventLogger) { // This class is a singleton: there may be but one instance at any one time. Use the // static logger reference as a gate. if (/*invalid?*/ eventLogger == null) throw new ArgumentNullException(ClassName + ": " + "logger access (eventLogger) must not be null"); Logger = eventLogger; // Prepare several properties by reassigning their current/initial values. The property // methods automatically fetch, validate and assign the application's configuration // values. BytesPerPixel = BytesPerPixel; ImageBytesPerPixel = ImageBytesPerPixel; CommandIpAddress = CommandIpAddress; CommandIpPort = CommandIpPort; DataIPPort = DataIPPort; try { Logger.LogInfo("+++" + ClassName + "+++"); } catch { } CommandIsReady = DataIsReady = false; }