/// <summary> /// Constructor /// </summary> /// <param name="stateMachineInputCallback"></param> public RemoteRecorderSync(MainAppLogic.EnqueueStateMachineInput stateMachineInputCallback) { RemoteRecorderVersion = null; SetUpController(); this.stateMachineInputCallback = stateMachineInputCallback; try { //Try to get the current remote recorder version number Process result = Process.GetProcessesByName("RemoteRecorder").FirstOrDefault(); if (result != null) { AssemblyName an = AssemblyName.GetAssemblyName(result.MainModule.FileName); this.RemoteRecorderVersion = an.Version; } } catch { //If we fail to get the RR version, set it to 4.9.0 by default. this.RemoteRecorderVersion = Version.Parse("4.9.0"); } //Start background thread to listen for input from recorder BackgroundWorker bgw = new BackgroundWorker(); bgw.DoWork += delegate { BackgroundPollingWorker(); }; bgw.RunWorkerAsync(); }
/// <summary> /// Constructor /// </summary> /// <param name="stateMachineInputCallback">delegate to call when there's an event to report</param> public DelcomLight(MainAppLogic.EnqueueStateMachineInput stateMachineInputCallback, TimeSpan holdTime) { hUSB = DelcomLightWrapper.TryOpeningDelcomDevice(); Delcom.DelcomEnableAutoConfirm(hUSB, 0); // Make sure we always start turned off DelcomLightWrapper.DelcomLEDAllAction(hUSB, DelcomLightWrapper.LightStates.Off); // remember the delegate so we can invoke when we get input this.stateMachineInputCallback = stateMachineInputCallback; //Initialize hold threshold from argument passed from Main this.holdThreshold = holdTime; // start a background thread to poll the device for input BackgroundWorker bgw1 = new BackgroundWorker(); bgw1.DoWork += delegate { this.BackgroundPollingWorker(); }; bgw1.RunWorkerAsync(); }