public static void LedOnAll(RFID_Device localDevice, List <string> tagsList) { int nbTagToLight = tagsList.Count; // initial number of tags localDevice.TestLighting(tagsList); string message = String.Format("{0} tags to find : {1} have been found.", nbTagToLight, nbTagToLight - tagsList.Count); if (tagsList.Count > 0) // some tag UIDs are still in the list : they've not been found { message += "\nMissing tags ID :"; foreach (string missingTag in tagsList) { message = String.Format("{0}\n{1}", message, missingTag); } } MessageBox.Show(message); // while user doesn't close the dialog, the led-lighting thread is still running localDevice.StopLightingLeds(); // stops lighting once user closed MessageBox }
private void toolStripButtonFindByLed_Click(object sender, EventArgs e) { if (currentDevice == null) { return; } List <string> selectedTags = new List <string>(); foreach (ListViewItem currentItem in dataListView.Items) { OLVColumn olcevent = dataListView.GetColumn(0); string eventtype = currentItem.SubItems[olcevent.Index].Text; if (eventtype.Equals("Removed")) { continue; } OLVColumn olc = dataListView.GetColumn(1); string tagId = currentItem.SubItems[olc.Index].Text; selectedTags.Add(tagId); } int nbTagToLight = selectedTags.Count; if (nbTagToLight == 0) { return; } if ((currentDevice.ConnectionStatus == ConnectionStatus.CS_Connected) && (currentDevice.DeviceStatus == DeviceStatus.DS_Ready)) { currentDevice.TestLighting(selectedTags); string message = string.Empty; if ((nbTagToLight == 1) && ((nbTagToLight - selectedTags.Count) == 1)) { message = String.Format(ResStrings.str_LedTagFound, nbTagToLight, nbTagToLight - selectedTags.Count); } else if ((nbTagToLight - selectedTags.Count) == 1) { message = String.Format(ResStrings.str_LedFound2, nbTagToLight, nbTagToLight - selectedTags.Count); } else { message = String.Format(ResStrings.str_LedFound3, nbTagToLight, nbTagToLight - selectedTags.Count); } if (selectedTags.Count > 0) { message += ResStrings.str_LedMissing; foreach (string missingTag in selectedTags) { message = String.Format("{0}\n{1}", message, missingTag); } } MessageBox.Show(message, ResStrings.str_LED_Information, MessageBoxButtons.OK, MessageBoxIcon.Information); currentDevice.StopLightingLeds(); } }