public static CustomSerial getGCodeSerial()
 {
     if (gCodeSerialChannel == null)
     {
         gCodeSerialChannel = new CustomSerial();
     }
     return gCodeSerialChannel;
 }
        public static CustomSerial getGCodeSerial()
        {
            if (gCodeSerialChannel == null)
            {
                gCodeSerialChannel = new CustomSerial();

                try
                {
                    gCodeSerialChannel.configure("COM4", "57600", "8", "One", "None");

                    //PCAN.ctrCanConnector temp = new PCAN.ctrCanConnector();
                    //temp.connect("51");

                    gCodeSerialChannel.Open();
                }
                catch (Exception e)
                {
                }
            }
            return(gCodeSerialChannel);
        }
 private void ConfigureSerialPort(CustomSerial gcodeChan)
 {
     string portName = cmbPortName.SelectedItem.ToString();
     string baudRate = txtBaudeRate.Text;
     string dataBits = txtDataBits.Text;
     string stopBits = cmbStop.SelectedItem.ToString();
     string parityBits = cmbParity.SelectedItem.ToString();
     gcodeChan.configure(portName, baudRate, dataBits, stopBits, parityBits);
 }