private void serialPort_ConnectedStateChanged(object sender, ConnectedStateChangedEventArgs statusargs) { // send last received text buffer before disconnecting if (!statusargs.Connected && !String.IsNullOrEmpty(textBuffer)) { try { stringReceived(textBuffer); } catch { } } // reset text receive buffer textBuffer = ""; if (statusChanged != null) { statusChanged(statusargs.Connected); } }
private void serialport_ConnectedStateChanged(object sender, ConnectedStateChangedEventArgs statusargs) { if (statusargs.Connected && !isInitialized) { discoveryTimer.Change(5000, Timeout.Infinite); } else { isInitialized = false; } }
private void serialPort_ConnectedStateChanged(object sender, ConnectedStateChangedEventArgs statusargs) { if (statusChanged != null) { statusChanged(statusargs.Connected); } }