Drowzee 3 Posting Whiz in Training

Hello, everyone. It's been a while.

I'm still working on the same Ultrasound machine GUI, but I'd taken time off for summer courses. Fortunately, thanks to the help I received here, I have made great advances in my program over the previous coder's attempt, but I'm now facing a bit of a problem.

I don't have code yet, and I won't have much to show until I've got a clear idea of the best way to begin.


Here's the problem.

This ultrasound machine GUI needs to handle inputs from an electrocardiogram machine. Currently, there is an event handler for a signal.

/// <summary>
		/// Event handler for signal from hand trigger. Needs to be debounced. 
		/// </summary>
		private void OnTrigger1()
		{
			if(this.cbCaptureType.SelectedIndex==1)			//Only trigger if the correct setting is used, and 
			{
				dt.AcquireOn=true;
				captureState = 1;
				if(this.mIBirdOn.Checked)
					bird.Point();			//DataisHere will call GetSingleFrame after a bird position is read in.
				else
					GetSingleFrame();      
			}
		}

I made it a while back and haven't touched it since as I worked on developing a better way of implementing filesaving and improving the backend of the interface.

When the user is doing ECG-based captures, they can use 0-2 delays (length of delay set by trackbars and enabled/disabled by checkboxes) that will take a single frame capture at the termination of the delay period.

The problem is, what to do when another signal comes in from the ECG before the image captures have completed.

Luckily, the human heart cannot generate pulses as cleanly as a signal generator, so there's an easy answer for handling a premature heart signal. If it comes between the initial signal and the first capture, don't take capture the first or second image for the initial signal.

If the initial signal's first capture is taken and then the new signal arrives, skip the second capture for the initial and focus on getting both of the new signal's captures.

The problem is the implementation.

I'll need to be able to check for a second trigger signal while the program waits to take the appropriate images for the initial signal.

When I think of how to do this in a single thread, I'm not sure I'd be able to catch a vitally-important ECG trigger.

I think that using another thread for checking for ECG trigger changes would be a good idea. I could use a flag from the second thread in a while loop to allow early termination and achieve the desired effects, but I'm not entirely sure it's necessary.

If more information is needed, I'd be happy to provide it.

Thanks in advance!