bool StartSerial(string portName, int baudRate) { try { serialReader = new SerialReader(this, portName, baudRate); } catch (Exception) { return(false); } return(true); }
private void Stop() { if (started) { cancelTokenSource.Cancel(); try { serialTask.Wait(); } catch (AggregateException) { } serialReader.Dispose(); serialReader = null; SetStarted(false); } }