private void bDisconnect_Click(object sender, EventArgs e) { if (!NFCHandler.IsInitialized) { return; } if (theTag != null) { tATR.Text = tUID.Text = tType.Text = tData.Text = ""; theTag.Dispose(); theTag = null; } }
public void Stop() { if (!NFCHandler.IsInitialized) { return; } if (_currentTag != null) { _currentTag.Dispose(); } try { if (_nfcReader != null) { _nfcReader.StopPolling(); // spin for a second to allow the NFC reader to timeout for (var i = 0; i < 100; i++) { Thread.Sleep(10); } } NFCHandler.Release(); } catch (Exception ex) { // ignore errors on cleanup } }