Firstly and most importantly the software is able to detect the presence of the Z controller. The Z controller is an arduino nano, this means it has a USB to serial chip on it and it can be plugged and unplugged at any point. The PC controller detects removal and arrival of USB devices and uses those notifications to check that the controller is still attached. It gets a list of current serial ports and attempts to open them all one at a time, if successful it pings the device with a "?". If the Z controller is on the other end of the port it replies with "Z Controller" and the PC knows it has found the device. The status is updated in the square at the top which show green/pink for connected/disconnected but it also gives a tool tip text response too.
Because this is really going to be used to drop the z axis by a specified amount between cutting layers (allowing for n passes of a thick sheet of material) I added a text box on the bottom which you can enter a specific value in to. The value is parsed to make sure it is a numeric value, again with pink/green qualifiers. The actual value is sent to the controller when you click the Green +Z and -Z arrows.
So if you want the Z axis to drop 2.5mm change the value in the text box and click the down arrow.
The User Interface is designed to be skinny and unobtrusive so it can sit on the computer and not get in the way of Lasercut or CAD package. This means the program can't have a header like a normal window (but it still appears on the taskbar).
When you hover over the middle white button the cursor changes to arrows, if you click and drag this button you can move the form around to wherever you want it. When you release the button the form stays in that location and it remembers where you left it when the program closes.
A menu system pops up when you right click the middle button, this allows you to close the program but also decide whether the program should be displayed above all the other programs. This means it can stay on top of Lasercut even when Lasercut is running full size. The program also remembers this option when the program closes.