日期:2014-05-16 浏览次数:21186 次
//功能是每天按时监控word内一个表格数据,如果在设定的时间点数据发生变化就将表格整体录入数据库
private void button3_Click(object sender, EventArgs e)
{
td = new Thread(delegate()
{
while (true)
{
this.Invoke((MethodInvoker)delegate()
{
if (listBox1.Items.Count > 0)//任务栏内有任务
{
foreach (object eachSetTime in listBox1.Items)
{
if (((Time)eachSetTime).needToExecute == true && ((Time)eachSetTime).hour.ToString() == DateTime.Now.Hour.ToString() &&
((Time)eachSetTime).minute.ToString() == DateTime.Now.Minute.ToString() &&
((Time)eachSetTime).second.ToString() == DateTime.Now.Second.ToString())
{
((Time)eachSetTime).needToExecute = false;//needToExecute表示是否需要执行任务,true表示需要,false表示已执行不需再执行
&nb