private void Application_Startup(object sender, StartupEventArgs e) { log.Info("Application Starting"); log.Info(String.Format("Using config file : {0}", configFile)); log.Info("----------------------------------------------------"); //Get the config file log.Debug("Setup configuration"); SystemConfig systemConfig = new SystemConfig(configFile); //Set up all the objects and delegates necesary to run the program log.Debug("Setup objects"); _physicalLayer = new PhysicalLayer(systemConfig.getDeviceConfig()); LogicalLayer logicalLayer = new LogicalLayer(_physicalLayer); _physicalLayer.setDelegate(logicalLayer); _uiHandle = new UIHandle_LLSL(logicalLayer); _sequencerLayer = new SequencerLayer(_uiHandle, logicalLayer, systemConfig.getSequencerConfig()); //Setup main window log.Debug("Setup main window"); MainWindow wnd = new MainWindow(); logicalLayer.setUIDelegate(wnd); _sequencerLayer.setUIDelegate(wnd); wnd.setDelegate(_uiHandle); wnd.Show(); }
/// <summary> /// Creates a new sequencer with a reference to the UIHandle and logicalLayer objects /// This object is responsible for organizing the timing of all events /// </summary> /// <param name="inUIHandler">Reference to the UIHandler</param> /// <param name="inLogicalLayer">Reference to the logical layer</param> public SequencerLayer(UIHandle_LLSL inUIHandler, LogicalLayer inLogicalLayer, SequencerConfig inSequencerConfig) { log.Debug(string.Format("Creating sequencer:{0} with logicalLayer:{1} and UIHandler:{2}", this, inLogicalLayer, inUIHandler)); _uiHandler = inUIHandler; _logicalLayer = inLogicalLayer; _shouldStop = false; _sequencerConfig = inSequencerConfig; startSequencerThreads(); }
/// <summary> /// Create the new UIHandle_LLSL and give it a new queue /// </summary> /// <param name="inLogicalLayer">Logical Layer, used to send UI messages to the device</param> public UIHandle_LLSL(LogicalLayer inLogicalLayer) { log.Debug(string.Format("Creating UIHandle__LLSL with logical layer: {0}", inLogicalLayer)); _eventQueue = new ConcurrentQueue <Event>(); _queueProcessingThread = new Thread(this.processQueue); _queueProcessingThread.Name = "queueProcessingThread"; _queueProcessingThread.Start(); _shouldStop = false; _enqueueEvent = new AutoResetEvent(false); _startTestSequenceEvent = new AutoResetEvent(false); _startTwoOzSequenceEvent = new AutoResetEvent(false); _startFourOzSequenceEvent = new AutoResetEvent(false); _startEightOzSequenceEvent = new AutoResetEvent(false); _logicalLayer = inLogicalLayer; }