private void Button_GetSensor_Click(object sender, RoutedEventArgs e) { //GetSensor --> Search for TELID® transponders if (m_DocInterface != null) { if (m_DocInterface.IsInitialized) { DateTime startTime = DateTime.UtcNow; //This function blocks & searches for a default time of 1 second (optional parameter) try { textBox_ThreadLog.Text += "\n = GetSensor =\n"; var getSensorResult = m_DocInterface.GetSensorData(0xFC); //0xFC = scan all TELID® types TimeSpan processSpan = DateTime.UtcNow - startTime; if (getSensorResult != null) { textBox_Result.Text = "- TELID® found -\n"; textBox_Result.Text += string.Format("SerNo: {0}\n", getSensorResult.SerialNumber); textBox_Result.Text += string.Format("Description: {0}\n", getSensorResult.Description); textBox_Result.Text += "Measurements:\n"; foreach (var meas in getSensorResult.Measurements) { textBox_Result.Text += string.Format("\tTimestamp: {0}\n", meas.Timestamp); textBox_Result.Text += "\tValues:\n"; foreach (var value in meas.Values) { textBox_Result.Text += string.Format("\t {0}{1}{2}\n", value.Symbol, value.Magnitude, value.Unit); } } string toLog = string.Format("Result: OK. Duration: {0}\n", processSpan); toLog += "- Sensor Result -\n"; toLog += string.Format("\tSerNo: {0}\n", getSensorResult.SerialNumber); toLog += string.Format("\tNumMeas: {0}\n", getSensorResult.Measurements.Length); textBox_ThreadLog.Text += toLog; textBox_ThreadLog.ScrollToEnd(); } else { //Update result in UI textBox_ThreadLog.Text += string.Format("Result: FAIL. Duration: {0}\n", processSpan); textBox_ThreadLog.ScrollToEnd(); } } catch (Exception ex) { TimeSpan processSpan = DateTime.UtcNow - startTime; textBox_ThreadLog.Text += string.Format("Result: Exception. Duration: {0}\n", processSpan); textBox_ThreadLog.ScrollToEnd(); System.Diagnostics.Debug.WriteLine(ex.ToString()); } } } }