public void SetValve(Valve Valve, bool NewState) { string message; if (NewState) { message = Valve.ToString().ToUpper(); } else { message = Valve.ToString().ToLower(); } GlobalVars.gPort.WriteLine(message); ValveStates[(int)Valve] = NewState; }