自主RFID标签读取和信息存储 [英] Autonomous RFID Tag Reading and Information Storage

查看:135
本文介绍了自主RFID标签读取和信息存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的任务是修改C#中的RFID标签读取程序.目标是创建一个主要是自主的出勤程序,该程序连续收集标签数据(当前显示在文本框中)并导出新找到的标签 数据保存到文本文件中.当前,该程序获取带有按钮单击事件的标签.我可以使用循环来连续扫描(显然它应该在整个上课期间进行扫描),但是由于我没有经验,所以对如何打破循环几乎一无所知 使用C#编程.任何帮助将不胜感激.

I've been tasked with the modification of an RFID Tag reading program in C#. The goal is to create a mostly autonomous attendance program that continously gathers tag data (which is currently displayed in the text box) and exports newly found tag data to a text file. Currently, the program gets tags with a button click event. I can use a loop for it to continously scan (which it should apparently do throughout a class period), but have very little idea on how to break the loop, as I have no experience with C# programming. Any help would be greatly appreciated.

1.当循环阻止按下其他按钮时,如何通过按钮按下事件中断循环?

1. How do I break a loop with a button press event when the loop prevents pressing other buttons?

2.如何自动将文本文件附加到刚收到的文本文件中 数据(显示在文本框中)?

2. How do I autonomously append a text file with only newly recieved data (which displays in the textbox)?

推荐答案

  1. 可能有一个变量或属性作为循环评估的一部分,可以通过按钮设置. IE.只要变量为假,就运行循环-按钮事件将其设置为true,这将结束循环.
  2. 如果文本框应包含曾经接收到的所有数据,则需要保持跟踪已经以某种方式写入了哪些数据.如果那不重要,则可以将文本框用于此目的,并在将数据写入后将其清除. 文本文件.在这种情况下,写入文本文件就变成了从文本框中读取文本并以追加"模式写入文本文件的问题(例如;
  1. Maybe have a variable or property as a part of the loop's evaluation, that can be set by the button. I.e. run the loop as long as the variable is false - the button event sets it to true, and that will end the loop.
  2. If the textbox should contain all the data ever received, then you need to keep track of what data that has already been written somehow. If that is not important, you could use the textbox for that purpose and clear it after you've written the data to the text file. In that case, the writing of the text file becomes a matter of reading from the textbox and writing to the text file in 'append' mode (for example;

using (StreamWriter writer = new StreamWriter(fileName, true))
{
writer.Write(textBoxContent);
}



这篇关于自主RFID标签读取和信息存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆