public void launch(string commandLineArguments = "") { processStartInfo.Arguments = commandLineArguments; process = new Process { EnableRaisingEvents = true, StartInfo = processStartInfo }; process.OutputDataReceived += outputLogHandler; process.ErrorDataReceived += errorLogHandler; process.Exited += processExited; try { process.Start(); } catch (Exception ex) { dataDisplayer.ShowError("Error starting process"); } process.BeginOutputReadLine(); process.BeginErrorReadLine(); }
public void Connect(string portName) { serialPort = new System.IO.Ports.SerialPort(portName, _baudrate, _parity, _dataBits, _stopBits); try { serialPort.Open(); _dataDisplayer.Show("Connected"); serialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedCallback); } catch (Exception ex) { _dataDisplayer.ShowError(ex.ToString()); } }