Ejemplo n.º 1
0
 public UIManager(EventLoggerAccess logger)
 {
     _Logger = logger;
     _FrameWork = new FrameWork(logger);
     _AssemblyDisplays = new List<AssemblyDisplays>();
     _DisplayLock = new object();
 }
Ejemplo n.º 2
0
 public RequestManager (DataAccess dataAccess, StatusManager statusManager, EventLoggerAccess logger)
 {
     _Logger = logger;
     _DataAccess = dataAccess;
     _DataAccess.DisplayControlUpdateRequest += new DashboardControlUpdateHandler(ProcessControlUpdateRequest);
     _StatusManager = statusManager;
 }
Ejemplo n.º 3
0
        public RealTimeViewer(EventLoggerAccess log, DetectorsDataAccess dataAccess)
        {
            _log = log;
            _dataAccess = dataAccess;
            _dataAccess.DisplayControlUpdateRequest += new Subsystem.DataAccessCore.DashboardControlUpdateHandler(_dataAccess_DisplayControlUpdateRequest);

            int dataPort = int.Parse(ConfigurationManager.AppSettings["RealTimeViewerDataPort"]);
            string address = ConfigurationManager.AppSettings["RealTimeViewerMulticastIPAddress"];
            _realTimeViewerBytesPerPixel = uint.Parse(ConfigurationManager.AppSettings["RealTimeViewerBytesPerPixel"]);
            _realTimeViewerPixelsPerColumn = uint.Parse(ConfigurationManager.AppSettings["RealTimeViewerPixelsPerColumn"]);

            _masterControlAddress = string.Empty;

            if ((dataAccess.Detectors.PixelPerColumn > _realTimeViewerPixelsPerColumn) &&
                (_realTimeViewerPixelsPerColumn != 0))
            {
                float value = (float)dataAccess.Detectors.PixelPerColumn / (float)_realTimeViewerPixelsPerColumn;
                _pixelInterval = (int)(Math.Round(value, 0, MidpointRounding.ToEven));
            }
            else
                _pixelInterval = 1;

            try
            {
                _realTimeViewerHost = new RealTimeViewerHost(address, dataPort);
            }
            catch { }

            _inComingDataColl = new BlockingCollection<DataInfo>(AppConfiguration.DataCollectionMaxSize);
        }
Ejemplo n.º 4
0
        public ApcsAccess(EventLoggerAccess log)
        {
            Lgr = log;
            Debug.Assert(Lgr != null);

            _serverAddress = ConfigurationManager.AppSettings["ApcsAddress"];
            _serverPort = int.Parse(ConfigurationManager.AppSettings["ApcsPort"]);
            Connected = false;

            _responseEvent = new AutoResetEvent(false);
            SpeedMsgEvent = new AutoResetEvent(false);

            _signOfLifeTimer = new Timer(new TimerCallback(SignOfLifeCheck), null, Timeout.Infinite, Timeout.Infinite);
            _signOfLifeTimerDueTime = 20000;

            _connectionThread = new Thread(new ThreadStart(ConnectionThreadMethod));
            _connectionThread.Name = "APCS Command Connection Thread";
            _connectionThread.IsBackground = true;

            _responseThread = new Thread(new ThreadStart(ResponseThreadMethod));
            _responseThread.Name = "APCS Command Response Thread";
            _responseThread.IsBackground = true;

            _sendConfigDataThread = new Thread(new ThreadStart(SetConfigurationThreadMethod));
            _sendConfigDataThread.Name = "APCS Send Configuration Data Thread";
            _sendConfigDataThread.IsBackground = true;
        }
Ejemplo n.º 5
0
 public DetectorRequestManager(DetectorsDataAccess dataAccess, DetectorsStatusManager statusManager, EventLoggerAccess logger)
     : base (dataAccess, statusManager, logger)
 {
     _logger = logger;
     _dataAccess = dataAccess;
     _dataAccess.DisplayControlUpdateRequest += new DashboardControlUpdateHandler(ProcessControlUpdateRequest);
 }
Ejemplo n.º 6
0
        public DetectorsStatusManager(DetectorsDataAccess dataAccess, EventLoggerAccess logger) :
            base(dataAccess, logger)
        {
            _logger = logger;
            Dictionary<int, string> ConnectionValueMapping = new Dictionary<int, string>();
            ConnectionValueMapping.Add(0, TagValueTypes.Error);
            ConnectionValueMapping.Add(1, TagValueTypes.Clear);

            StatusElement detectorConnect = new StatusElement(_DetectorConnectTag, 0, TagTypes.Status, ConnectionValueMapping);
            //detectorConnect.Value = 
            _Statuses.Add(detectorConnect);


            StatusElement apcsConnect = new StatusElement(_APCSConnectTag, 0, TagTypes.Status, ConnectionValueMapping);
            _Statuses.Add(apcsConnect);

            dataAccess.DetectorConnectionStateUpdate +=
                    new ConnectionStateChangeHandler(OnDetectorsConnectionChange);
            dataAccess.APCSConnectionStateUpdate +=
                    new ConnectionStateChangeHandler(OnApcsConnectionChange);

            Dictionary<int, string> DetectorsValueMapping = new Dictionary<int, string>();
            DetectorsValueMapping.Add(0, TagValueTypes.Clear);
            DetectorsValueMapping.Add(1, TagValueTypes.Warning);
            DetectorsValueMapping.Add(2, TagValueTypes.Error);
            DetectorsValueMapping.Add(3, TagValueTypes.Warning);

            StatusElement detectorStatus = new StatusElement(_DetectorStatusTag, 0, TagTypes.Status, DetectorsValueMapping);
            _Statuses.Add(detectorStatus);
        }
Ejemplo n.º 7
0
        public MainWindow ()
        {
            InitializeComponent();

            _Logger = new EventLoggerAccess();

            _DataAccess = new DataAccess(_Logger);
            _BusinessManager = new BusinessManager(_DataAccess, _Logger);
        }
Ejemplo n.º 8
0
  /// <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 + "+++");
 }
Ejemplo n.º 9
0
 public LinacDataAccess(EventLoggerAccess logger) : 
     base(logger)
 {
     string ipAddress = ConfigurationManager.AppSettings["LinacIP"];
     int port = Convert.ToInt32(ConfigurationManager.AppSettings["LinacPort"]);
     int time = Convert.ToInt32(ConfigurationManager.AppSettings["LinacPingTime"]);
     _LinacAccess = new LinacAccess(logger, ipAddress, port, time);
     _LinacAccess.ConnectionStateChangeEvent += new ConnectionStateChangeHandler(LinacAccess_ConnectionStateChangeEvent);
 }
Ejemplo n.º 10
0
        public StatusInfoDisplay(EventLoggerAccess logger)
        {
            InitializeComponent();
            CultureResources.registerDataProvider(this);

            _Logger = logger;

            CriticalErrorsArea.SizeChanged += new SizeChangedEventHandler(CriticalErrorsArea_SizeChanged);
            WarningMessagesArea.SizeChanged += new SizeChangedEventHandler(WarningMessagesArea_SizeChanged);
        }
Ejemplo n.º 11
0
 /// <summary>Create and prepare a new class instance.</summary>
 /// <param name="dataAccess">
 /// Data Access specifies a <see cref="DataAccess"/> instance and must not be
 /// null...</param>
 /// <param name="eventLogger">
 /// Event Logger specifies a <see cref="EventLoggerAccess"/> instance and must not be
 /// null...</param>
 /// <exception cref="ArgumentNullException">
 /// If either <paramref name="dataAccess"/> or <paramref name="eventLogger"/> specifies
 /// null, an exception is thrown.</exception>
 public BusinessManager(DataAccess dataAccess, EventLoggerAccess eventLogger)
 {
     if (/*invalid?*/ eventLogger == null)
         throw new ArgumentNullException(ClassName + " EventLoggerAccess reference argument (eventLogger) must not be null");
     Logger = eventLogger;
     if (/*invalid?*/ dataAccess == null)
         throw new ArgumentNullException(ClassName + " DataAccess reference argument (dataAccess) must not be null");
     StatusManagerReference = new StatusManager(dataAccess, eventLogger);
     RequestManagerReference = new RequestManager(dataAccess, StatusManagerReference, eventLogger);
 }
Ejemplo n.º 12
0
 /// <summary>Create and prepare a new class instance.</summary>
 /// <param name="eventLogger">
 /// Event Logger specifies a <see cref="EventLoggerAccess"/> instance and must not be
 /// null...</param>
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="eventLogger"/> specifies null, an exception is thrown.</exception>
 public DataAccess(EventLoggerAccess eventLogger) :
     base(eventLogger)
 {
     if (/*invalid?*/ eventLogger == null)
         throw new ArgumentNullException(ClassName + " EventLoggerAccess reference argument (eventLogger) must not be null");
     Logger = eventLogger;
     Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
     _opcClient = new OpcClient(configuration.GetSection("opcSection") as OpcSection, ConfigurationManager.AppSettings["TagGroup"], Logger);
     _opcClient.OpcTagUpdate += new OpcTagUpdateHandler(OpcTagUpdate);
     _opcClient.Open();
 }
Ejemplo n.º 13
0
        public NormalizeData(EventLoggerAccess log, DetectorsDataAccess dataAccess, Calibration calibration)
        {
            _log = log;
            _dataAccess = dataAccess;
            _calibration = calibration;
            _objectSearch = new ObjectSearch(log, dataAccess, _calibration);
            _rawDataColl = new BlockingCollection<DataInfo>();

            _normalizeThread = Threads.Create(NormalizeAgent, ref _normalizeEnd, "Normalization thread");
            _normalizeThread.Start();
        }
Ejemplo n.º 14
0
        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());
        }
Ejemplo n.º 15
0
        public DataAccess (EventLoggerAccess logger) : 
            base(logger)
        {
            _logger = logger;
            Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            _OpcClient = new OpcClient(
                    configuration.GetSection("opcSection") as OpcSection,
                    ConfigurationManager.AppSettings["TagGroup"],
                    _logger);
            _OpcClient.OpcTagUpdate += new OpcTagUpdateHandler(_OpcClient_OpcTagUpdate);
            _OpcClient.Open();

        }
Ejemplo n.º 16
0
        public ObjectSearch(EventLoggerAccess log, DetectorsDataAccess dataAccess, Calibration calibration)
        {
            _log = log;
            _dataAccess = dataAccess;
            _archiveData = new ArchiveData(log, calibration);

            _inComingDataColl = new BlockingCollection<DataInfo>();

            _searchThread = Threads.Create(SearchAgent, ref _searchEnd, "Object Search thread");
            _searchThread.Start();

            _foundObject = false;
        }
Ejemplo n.º 17
0
        public StatusManager (DataAccess dataAccess, EventLoggerAccess logger)
        {
            Logger = logger;
            _Statuses = new StatusElements();
            DataAccess = dataAccess;
            
            _StatusLock = new object();

            ReadTagConfig();

            DataAccess.TagUpdate += new PLCTagUpdateHandler(PLCTagUpdate);
            DataAccess.DisplayUpdateRequest += new DashboardUpdateRequestHandler(DashboardUpdateRequest);
        }
Ejemplo n.º 18
0
 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;
 }
Ejemplo n.º 19
0
        public RealTimeViewer(EventLoggerAccess log)
        {
            _log = log;
            IsDualEnergy = false;
            _realTimeViewerHost = new RealTimeViewerHost(AppConfiguration.RealTimeViewerMulticastIPAddress,
                                                         AppConfiguration.RealTimeViewerDataPort,
                                                         AppConfiguration.RealTimeViewerUdpClientPort,
                                                         log);

            _inComingDataColl = new BlockingCollection<DataInfo>();
            

            _sendThread = Threads.Create(SendAgent, ref _sendEnd, "Real Time View Data Send thread");
            _sendThread.Start();
        }
Ejemplo n.º 20
0
        public DetectorSimulator(DataAccessDetectors dataAccess, EventLoggerAccess logger, BusinessManager businessManager)
        {
            try
            {
                InitializeComponent();

                _dataAccess = dataAccess;
                _logger = logger;
                _businessManager = businessManager;
                _businessManager.RecordData = false;
            }
            catch
            {
                throw;
            }
        }            
Ejemplo n.º 21
0
        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();
            }
        }
Ejemplo n.º 22
0
        public OpcClient (OpcSection opcSection, string tagGroup, EventLoggerAccess logger)
        {
            _logger = logger;
            _OpcSection = opcSection;
            _TagGroup = tagGroup;

            _GroupReadState = new SubscriptionState();
            _GroupReadState.Name = _OpcSection.Server.TagGroup.GetElement(_TagGroup).Name + " Read";
            _GroupReadState.UpdateRate = _OpcSection.Server.TagGroup.GetElement(_TagGroup).UpdateRate;
            _GroupReadState.Active = true;

            _GroupWriteState = new SubscriptionState();
            _GroupWriteState.Name = _OpcSection.Server.TagGroup.GetElement(_TagGroup).Name + " Write";
            _GroupWriteState.Active = false;

            _Items = new Item[_OpcSection.Server.TagGroup.GetElement(_TagGroup).Tags.Count];
        }
Ejemplo n.º 23
0
        public AssemblyManager(UIManager uiManager, DataAccess dataAccess, EventLoggerAccess logger)
        {
            _DataAccess = dataAccess;
            _DataAccess.setEvent(new SubsystemServiceListUpdateHandler(SubsystemServiceListUpdate));
            _Logger = logger;
            _UIManager = uiManager;
            _AssemblyInstances = new Dictionary<string, IDisplays>();

            if (Convert.ToBoolean(ConfigurationManager.AppSettings["StartUpClean"]))
            {
                string directory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                ConfigurationManager.AppSettings["SystemOperationMode"]);
                if (Directory.Exists(directory))
                {
                    DeleteDirectory(directory);
                }
            }
        }
Ejemplo n.º 24
0
        public DataAccessBase(EventLoggerAccess logger)
        {
            _AddressLock = new object();
            _TaskFactory = new TaskFactory(TaskCreationOptions.PreferFairness, TaskContinuationOptions.ExecuteSynchronously);
            _LastTask = new Task(new Action(() => { }));
            _LastTask.RunSynchronously();

			_logger = logger;
            _AvailableConnections = new List<EndpointAddress>();
            _DashboardAccess = new DashboardAccess();
            _DashboardAccess.Start();

            

            _SubsystemDisplayAccess = new SubsystemDisplayAccess();
            _SubsystemDisplayAccess.DisplayUpdateRequest += new DashboardUpdateRequestHandler(DisplaySendUpdate);
            _SubsystemDisplayAccess.ControlUpdateRequest += new DashboardControlUpdateHandler(DisplayControlUpdate);
        }
Ejemplo n.º 25
0
 private void Window_Closed(object sender, EventArgs eventArguments)
 {
     DetectorsApp.TestAPCS.SpeedMsgStop();
     try
     {
         if (/*exists (avoid first try exceptions)?*/ _businessManager != null)
             _businessManager.Dispose();
     }
     catch { }
     finally { _businessManager = null; }
     try
     {
         if (/*exists (avoid first try exceptions)?*/_dataAccess != null)
             _dataAccess.Dispose();
     }
     catch { }
     finally { _dataAccess = null; }
     _eventLoggerAccess.LogWarning(Utilities.ProcessKill(Process.GetCurrentProcess().Id, true));
     _eventLoggerAccess = null;
 }
Ejemplo n.º 26
0
        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();
        }
Ejemplo n.º 27
0
        public FrameWork(EventLoggerAccess logger)
        {
            try
            {

                InitializeComponent();
                CultureResources.registerDataProvider(this);

                _Logger = logger;
                _StatusInfoDisplay = new StatusInfoDisplay(logger);
                _StatusAdorner = new AdornerContentPresenter(DisplayArea, _StatusInfoDisplay);
                _AboutBox = new AboutBox();
                _AboutAdorner = new AdornerContentPresenter(DisplayArea, _AboutBox);
                _AdornerLayerManager = new AdornerLayerManager(AdornerLayer.GetAdornerLayer(DisplayArea));
                _WidgetPages = new List<WidgetPage>();
            }
            catch
            {
            }
        }
Ejemplo n.º 28
0
	/// <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;
    }
Ejemplo n.º 29
0
        public LinacAccess(EventLoggerAccess log, string address, int port, int pingDuetimeMsec)
        {
            _shutdown = false;

            IsConnected = false;

            _flushNetworkStream = false;

            _pingDueTimeMsec = pingDuetimeMsec;

            _pingAckReceived = false;

            _logger = log;

            _address = address;
            _port = port;

            _commandResponseList = new List<LinacPacketFormat.DataPacket>();

            _FlushingNetworkDoneEvent = new AutoResetEvent(false);
            _commandResponseEvent = new AutoResetEvent(false);
        }
Ejemplo n.º 30
0
        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);
        }