private void opennewform() { if (UISerial.IsOpen) { UISerial.DtrEnable = false; UISerial.Close(); } Application.Run(new Authorization()); }
//getting serial ports (modified from Bernard's code(maintanceMode), modified to auto connect if a port exists) public void getSerialPorts() { string[] ports; ports = SerialPort.GetPortNames(); try { UISerial.PortName = ports[0]; UISerial.Open(); UISerial.DtrEnable = true; Console.WriteLine("connected to:" + UISerial.PortName + Environment.NewLine); } catch { Console.WriteLine("can't connect to serial bus" + Environment.NewLine); //System.Windows.Forms.MessageBox.Show("Cannot connect to system please contact park staff"); } }