This one has been kicking my ass.
I create a new SerialPort instance easy enough. However, I want to get the port name from a DRO instead of just writing it in the plugin code like this:
- Code: Select all
SerialPort MyPort = new SerialPort("COM1");
I used the example plugin and made the changes shown in the screenshot. Wherever I added code I commented "// MY CHANGES".
As can be seen, I'm getting the red squiggly line under "UC", in the static constructor.
I used a static constructor because I read that it runs at the beginning of the class instanciation, before any class members are created, and therefore thought I could use that to get the port name from the DRO before the SerialPort object is created.
Obviously I'm doing something wrong.
Keith