Looks like some of your braces are mixed up? Try moving "}" before When.WebServiceCallReceived to close HandleStatusChanged action. You'll need to delete the brace which is down at the end about 45 lines.
Action<bool>
HandleStatusChanged = (bool connected) => {
// this will be called every time the connection status changes
Program.Notify("SerialPort Status", connected ? "CONNECTED!" : "DISCONNECTED!");
/* As a switch, the module should also handle "Control.On" and "Control.Off" commands issued by the user
from the Web user interface, or by scripting. (define Web service) */
} // <== MOVE BRACE TO HERE to finish the action
When.WebServiceCallReceived("ArduRCswitch", ( args ) =>