Пример #1
0
        bool StartSerial(string portName, int baudRate)
        {
            try {
                serialReader = new SerialReader(this, portName, baudRate);
            }
            catch (Exception) {
                return(false);
            }

            return(true);
        }
Пример #2
0
 private void Stop()
 {
     if (started)
     {
         cancelTokenSource.Cancel();
         try {
             serialTask.Wait();
         }
         catch (AggregateException) { }
         serialReader.Dispose();
         serialReader = null;
         SetStarted(false);
     }
 }